- Баллы
- 123
Скрипт не мой, я его лишь модифицировал 3 строки дописал и 4 изменил. Все копирайты сохраняю.
Модифицирован под лаунчер Сашка, т.е чтоб с ним работал.
[Story]
Соответственно все данные изменены.
А вообще вот мои конфиги nginx'a на всякий(Соответственно все данные изменены.)
Гайд по настройке доступа к файлу без долгих мучений(на апаче .htaccess помощь, в две минуты) (Здесь немного извращений, но работает и работает отлично. Т.е для локал хоста можно снять все огр., если это необходимо в один файл.
Для локалхоста
1. копируем файл site.conf
1.2 меняем имя файла например на localhost.conf
1.3 Кладём к nginx'y в папку /etc/nginx/conf.d //На линуксе.
//все действия происходят в новом файле.
2. Меняем значение переменной server_name на 127.0.0.1 localhost;
Т.е вот так server_name 127.0.0.1 localhost;
3. Удаляем запрет на файл авторизации из файла конфига локалхоста
4. Меняем authProvider в конфиге(LaunchServer.cfg) лаунч-сервера
//url может отличаться в зависимости от расположение, скрипту(authen.php) лучше лежать в корне сайта. Тогда всё совпадает с гайдом.
Кое-чего потерял из-за того, что авторизация слетела, но как-то более менее компенсировал.
Модифицирован под лаунчер Сашка, т.е чтоб с ним работал.
[Story]
Долго искал хэш паролей новой джумлы.
Найти не удалось, только для старых версий.
Поэтому испрльзовал единственную возможность делать это через get запрос. Да-да есть можно сделать sql запрос, но углубиться в Joomla как-то не очень хотелось хотя бы потому что она хранит один и тот же пароль совершенно не типично и я резко обленился пилить sql запрос после недели безуспешных поисков.
И быстренько перепилил ранее найденный php скрипт для работы с лаунч-сервером.
Найти не удалось, только для старых версий.
Поэтому испрльзовал единственную возможность делать это через get запрос. Да-да есть можно сделать sql запрос, но углубиться в Joomla как-то не очень хотелось хотя бы потому что она хранит один и тот же пароль совершенно не типично и я резко обленился пилить sql запрос после недели безуспешных поисков.
И быстренько перепилил ранее найденный php скрипт для работы с лаунч-сервером.
Скрипт вот так просто на весь мир выкидывать не стоит, скиньте его на локалхост, т.е, доступен только лаунч-серверу.
Скрипт работает без ограничений и бан в скрипте, как и капча не встроена, ибо это невозможно, проще переписать лаунчер.
Поэтому, если у кого-то будет такой скрипт лежать в открытом доступе то подобрать пароль к логину админа будет легко.
Ну я предупредил. И там ниже есть, о том, как позаботиться совсем чуть-чуть, чтобы скрипт не валялся в открытом доступе. Есть способы и проще, но другие у меня не заработали. Воспользовался этим. Ниже увидите.
Скрипт работает без ограничений и бан в скрипте, как и капча не встроена, ибо это невозможно, проще переписать лаунчер.
Поэтому, если у кого-то будет такой скрипт лежать в открытом доступе то подобрать пароль к логину админа будет легко.
Ну я предупредил. И там ниже есть, о том, как позаботиться совсем чуть-чуть, чтобы скрипт не валялся в открытом доступе. Есть способы и проще, но другие у меня не заработали. Воспользовался этим. Ниже увидите.
Соответственно все данные изменены.
<?php
/**
* Joomla! External authentication script
*
* @author vdespa
* @author MyauDesu
* Version 1.0
*
* Code adapted from /index.php
*
* @package Joomla.Site
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
if (version_compare(PHP_VERSION, '5.3.1', '<'))
{
die('Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!');
}
header("Content-Type: text/plain; charset=UTF-8");
// Verify login and password
$login = $_GET['login'];
$password = $_GET['password'];
if(empty($login) || empty($password)) {
exit('Empty login or password');
}
/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
// Instantiate the application.
$app = JFactory::getApplication('site');
// JFactory
require_once (JPATH_BASE .'/libraries/joomla/factory.php');
// Hardcoded for now
$credentials['username'] = $login;
$credentials['password'] = $password;
/**
* Code adapted from plugins/authentication/joomla/joomla.php
*
* @package Joomla.Plugin
* @subpackage Authentication.joomla
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Get a database object
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id, password')
->from('#__users')
->where('username=' . $db->quote($credentials['username']));
$db->setQuery($query);
$result = $db->loadObject();
if ($result)
{
$match = JUserHelper::verifyPassword($credentials['password'], $result->password, $result->id);
if ($match === true)
{
// Bring this in line with the rest of the system
$user = JUser::getInstance($result->id);
echo 'OK:' . $login;
}
else
{
// Invalid password
// Prmitive error handling
die('Invalid password');
}
} else {
// Invalid user
// Prmitive error handling
die('Cound not find user in the database');
}
?>
/**
* Joomla! External authentication script
*
* @author vdespa
* @author MyauDesu
* Version 1.0
*
* Code adapted from /index.php
*
* @package Joomla.Site
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
if (version_compare(PHP_VERSION, '5.3.1', '<'))
{
die('Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!');
}
header("Content-Type: text/plain; charset=UTF-8");
// Verify login and password
$login = $_GET['login'];
$password = $_GET['password'];
if(empty($login) || empty($password)) {
exit('Empty login or password');
}
/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
if (file_exists(__DIR__ . '/defines.php'))
{
include_once __DIR__ . '/defines.php';
}
if (!defined('_JDEFINES'))
{
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
}
require_once JPATH_BASE . '/includes/framework.php';
// Instantiate the application.
$app = JFactory::getApplication('site');
// JFactory
require_once (JPATH_BASE .'/libraries/joomla/factory.php');
// Hardcoded for now
$credentials['username'] = $login;
$credentials['password'] = $password;
/**
* Code adapted from plugins/authentication/joomla/joomla.php
*
* @package Joomla.Plugin
* @subpackage Authentication.joomla
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Get a database object
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id, password')
->from('#__users')
->where('username=' . $db->quote($credentials['username']));
$db->setQuery($query);
$result = $db->loadObject();
if ($result)
{
$match = JUserHelper::verifyPassword($credentials['password'], $result->password, $result->id);
if ($match === true)
{
// Bring this in line with the rest of the system
$user = JUser::getInstance($result->id);
echo 'OK:' . $login;
}
else
{
// Invalid password
// Prmitive error handling
die('Invalid password');
}
} else {
// Invalid user
// Prmitive error handling
die('Cound not find user in the database');
}
?>
А вообще вот мои конфиги nginx'a на всякий(Соответственно все данные изменены.)
server {
listen 80;
server_name site.ru;
server_name_in_redirect on;
server_tokens off;
root /var/nginx/www/sites/oldsite/site.ru/site/site;
access_log /var/nginx/www/sites/oldsite/site.ru/site/access.log;
error_log /var/nginx/www/sites/oldsite/site.ru/site/error.log;
index index.php index.html index.htm;
error_page 404 = http://site.ru/404.html;
#error_page 403 = /15-errors/9-403-forbidden.html;
if ($host = 'www.site.ru' ) {
rewrite ^/(.*)$ $scheme://site.ru/$1 permanent;
}
#allow 127.0.0.1;
#}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
deny 198.22.98.0/23;
deny 198.22.100.0/22;
deny 198.22.104.0/21;
deny 198.22.112.0/20;
deny 198.22.128.0/17;
deny 198.23.0.0/16;
deny 198.24.0.0/13;
deny 198.32.0.0/14;
deny 198.36.0.0/19;
if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}
if ($http_user_agent ~* msnbot|scrapbot|SputnikBot) {
return 403;
}
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) )
{
return 403;
}
#location ~* ^/(administrator)($|\/) {deny all; return 404;}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache one;
fastcgi_cache_min_uses 3;
fastcgi_cache_valid 200 301 302 304 5m;
fastcgi_cache_key "$request_method|$host|$request_uri";
#Если не использовать эту опцию - то в форумах все будут сидеть под именем первого вошедшего на форум
#fastcgi_hide_header "Set-Cookie";
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort off;
include /etc/nginx/fastcgi.conf;
}
location = /authen.php {
deny all;
return 404;
}
location = /nginx.conf {
log_not_found off;
access_log off;
return 404;
break;
}
location = /nginx.conf.admintools {
log_not_found off;
access_log off;
return 404;
break;
}
set $file_injection 0;
if ($query_string ~ "[a-zA-Z0-9_]=http://") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=(\.\.//?)+") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=/([a-z0-9_.]//?)+") {
set $file_injection 1;
}
if ($file_injection = 1) {
return 403;
break;
}
if ($query_string ~ "\=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}") {
return 403;
break;
}
location = /configuration.php-dist {
log_not_found off;
access_log off;
return 404;
break;
}
location = /htaccess.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config {
log_not_found off;
access_log off;
return 404;
break;
}
location = /configuration.php {
log_not_found off;
access_log off;
return 404;
break;
}
location = /CONTRIBUTING.md {
log_not_found off;
access_log off;
return 404;
break;
}
location = /joomla.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /LICENSE.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /phpunit.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /README.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config.txt {
log_not_found off;
access_log off;
return 404;
break;
}
add_header X-Frame-Options SAMEORIGIN;
#index index.php index.html index.htm;
location ~* \.(css|js)$ {
access_log off; log_not_found off;
expires 1w;
}
location ~* \.(bmp|gif|jpg|jpeg|jp2|png|svg|tif|tiff|ico|wbmp|wbxml|smil)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(pdf|txt|xml)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(mid|midi|mp3|m4a|m4r|aif|aiff|ra|wav|voc|ogg)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(swf|vrml|avi|mkv|mpg|mpeg|mp4|m4v|mov|asf)$ {
access_log off; log_not_found off;
expires 1M;
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied expired no-cache no-store private auth;
gzip_min_length 1000;
gzip_http_version 1.1;
gzip_types text/plain text/css application/xhtml+xml application/xml+rss application/rss+xml application/x-javascript application/javascript text/javascript application/json text/xml application/xml image/svg+xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
add_header Cache-Control "no-transform";
client_header_timeout 10;
client_body_timeout 10;
send_timeout 30;
keepalive_timeout 30s;
connection_pool_size 8192;
client_header_buffer_size 4k;
large_client_header_buffers 8 8k;
request_pool_size 8k;
sendfile on;
sendfile_max_chunk 1m;
postpone_output 0;
tcp_nopush on;
tcp_nodelay on;
output_buffers 8 32k;
charset utf-8;
source_charset utf-8;
ignore_invalid_headers on;
client_max_body_size 1G;
set $common_exploit 0;
if ($query_string ~ "proc/self/environ") {
set $common_exploit 1;
}
if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)") {
set $common_exploit 1;
}
if ($query_string ~ "base64_(en|de)code\(.*\)") {
set $common_exploit 1;
}
if ($query_string ~ "(<|%3C).*script.*(>|%3E)") {
set $common_exploit 1;
}
if ($query_string ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($query_string ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($common_exploit = 1) {
return 403;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /index.php$ {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_akeeba\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_admintools\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_joomlaupdate\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location ~* ^/templates\/prostar/.*$
{
break;
}
location ~* ^/administrator/(components|modules|templates|images|plugins)/.*.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/administrator$ {
return 301 /administrator/index.php;
}
location ~* ^/administrator/$ {
return 301 /administrator/index.php;
}
location ~* /administrator.*$ {
if (-e $request_filename) {
return 403;
}
try_files $uri $uri/ /administrator/index.php?$args;
}
location ~* ^/(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|ico|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/includes/js/ {
return 403;
}
location ~* ^/(cache|includes|language|logs|log|tmp)/ {
return 403;
}
location ~* ^/.*$ {
try_files $uri $uri/ /index.php?$args;
}
}
listen 80;
server_name site.ru;
server_name_in_redirect on;
server_tokens off;
root /var/nginx/www/sites/oldsite/site.ru/site/site;
access_log /var/nginx/www/sites/oldsite/site.ru/site/access.log;
error_log /var/nginx/www/sites/oldsite/site.ru/site/error.log;
index index.php index.html index.htm;
error_page 404 = http://site.ru/404.html;
#error_page 403 = /15-errors/9-403-forbidden.html;
if ($host = 'www.site.ru' ) {
rewrite ^/(.*)$ $scheme://site.ru/$1 permanent;
}
#allow 127.0.0.1;
#}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
deny 198.22.98.0/23;
deny 198.22.100.0/22;
deny 198.22.104.0/21;
deny 198.22.112.0/20;
deny 198.22.128.0/17;
deny 198.23.0.0/16;
deny 198.24.0.0/13;
deny 198.32.0.0/14;
deny 198.36.0.0/19;
if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}
if ($http_user_agent ~* msnbot|scrapbot|SputnikBot) {
return 403;
}
if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) )
{
return 403;
}
#location ~* ^/(administrator)($|\/) {deny all; return 404;}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache one;
fastcgi_cache_min_uses 3;
fastcgi_cache_valid 200 301 302 304 5m;
fastcgi_cache_key "$request_method|$host|$request_uri";
#Если не использовать эту опцию - то в форумах все будут сидеть под именем первого вошедшего на форум
#fastcgi_hide_header "Set-Cookie";
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort off;
include /etc/nginx/fastcgi.conf;
}
location = /authen.php {
deny all;
return 404;
}
location = /nginx.conf {
log_not_found off;
access_log off;
return 404;
break;
}
location = /nginx.conf.admintools {
log_not_found off;
access_log off;
return 404;
break;
}
set $file_injection 0;
if ($query_string ~ "[a-zA-Z0-9_]=http://") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=(\.\.//?)+") {
set $file_injection 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=/([a-z0-9_.]//?)+") {
set $file_injection 1;
}
if ($file_injection = 1) {
return 403;
break;
}
if ($query_string ~ "\=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}") {
return 403;
break;
}
location = /configuration.php-dist {
log_not_found off;
access_log off;
return 404;
break;
}
location = /htaccess.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config {
log_not_found off;
access_log off;
return 404;
break;
}
location = /configuration.php {
log_not_found off;
access_log off;
return 404;
break;
}
location = /CONTRIBUTING.md {
log_not_found off;
access_log off;
return 404;
break;
}
location = /joomla.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /LICENSE.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /phpunit.xml {
log_not_found off;
access_log off;
return 404;
break;
}
location = /README.txt {
log_not_found off;
access_log off;
return 404;
break;
}
location = /web.config.txt {
log_not_found off;
access_log off;
return 404;
break;
}
add_header X-Frame-Options SAMEORIGIN;
#index index.php index.html index.htm;
location ~* \.(css|js)$ {
access_log off; log_not_found off;
expires 1w;
}
location ~* \.(bmp|gif|jpg|jpeg|jp2|png|svg|tif|tiff|ico|wbmp|wbxml|smil)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(pdf|txt|xml)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(mid|midi|mp3|m4a|m4r|aif|aiff|ra|wav|voc|ogg)$ {
access_log off; log_not_found off;
expires 1M;
}
location ~* \.(swf|vrml|avi|mkv|mpg|mpeg|mp4|m4v|mov|asf)$ {
access_log off; log_not_found off;
expires 1M;
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied expired no-cache no-store private auth;
gzip_min_length 1000;
gzip_http_version 1.1;
gzip_types text/plain text/css application/xhtml+xml application/xml+rss application/rss+xml application/x-javascript application/javascript text/javascript application/json text/xml application/xml image/svg+xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
add_header Cache-Control "no-transform";
client_header_timeout 10;
client_body_timeout 10;
send_timeout 30;
keepalive_timeout 30s;
connection_pool_size 8192;
client_header_buffer_size 4k;
large_client_header_buffers 8 8k;
request_pool_size 8k;
sendfile on;
sendfile_max_chunk 1m;
postpone_output 0;
tcp_nopush on;
tcp_nodelay on;
output_buffers 8 32k;
charset utf-8;
source_charset utf-8;
ignore_invalid_headers on;
client_max_body_size 1G;
set $common_exploit 0;
if ($query_string ~ "proc/self/environ") {
set $common_exploit 1;
}
if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)") {
set $common_exploit 1;
}
if ($query_string ~ "base64_(en|de)code\(.*\)") {
set $common_exploit 1;
}
if ($query_string ~ "(<|%3C).*script.*(>|%3E)") {
set $common_exploit 1;
}
if ($query_string ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($query_string ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
set $common_exploit 1;
}
if ($common_exploit = 1) {
return 403;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /index.php$ {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_akeeba\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_admintools\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location = /administrator\/components\/com_joomlaupdate\/restore\.php {
fastcgi_pass 127.0.0.1:9000;
break;
}
location ~* ^/templates\/prostar/.*$
{
break;
}
location ~* ^/administrator/(components|modules|templates|images|plugins)/.*.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/administrator$ {
return 301 /administrator/index.php;
}
location ~* ^/administrator/$ {
return 301 /administrator/index.php;
}
location ~* /administrator.*$ {
if (-e $request_filename) {
return 403;
}
try_files $uri $uri/ /administrator/index.php?$args;
}
location ~* ^/(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|ico|htm|ttf|woff|woff2|eot|JPG|JPEG|PNG|GIF|CSS|JS|TTF|WOFF|WOFF2|EOT)$ {
break;
}
location ~* ^/includes/js/ {
return 403;
}
location ~* ^/(cache|includes|language|logs|log|tmp)/ {
return 403;
}
location ~* ^/.*$ {
try_files $uri $uri/ /index.php?$args;
}
}
Для локалхоста
1. копируем файл site.conf
1.2 меняем имя файла например на localhost.conf
1.3 Кладём к nginx'y в папку /etc/nginx/conf.d //На линуксе.
//все действия происходят в новом файле.
2. Меняем значение переменной server_name на 127.0.0.1 localhost;
Т.е вот так server_name 127.0.0.1 localhost;
3. Удаляем запрет на файл авторизации из файла конфига локалхоста
Код:
location = /authen.php {
deny all;
return 404;
}
//url может отличаться в зависимости от расположение, скрипту(authen.php) лучше лежать в корне сайта. Тогда всё совпадает с гайдом.
Код:
authProvider: "request";
authProviderConfig: {
url: "http://localhost/authen.php?login=%login%&password=%password%";
response: "OK:(?<username>.+)";
};
Последнее редактирование: