![]() |
![]() |
#11 |
Работаю ⌛
Доцент
Регистрация: 10.07.2020
Сообщений: 162
Сказал(а) спасибо: 6
Получил(а) "Спасибо": 250
Нарушения: 0/0 (0)
Репутация: 138205
|
![]()
Я сталкивался, с тем, что if (!-e $request_filename){ не работал, когда сама CMS не отдавал 404 ошибку, а гнала 200, что файл всё же существует и обрабатывала его.
|
![]() |
![]() |
![]() |
#12 |
Junior Member
Студент
Регистрация: 24.06.2020
Сообщений: 11
Сказал(а) спасибо: 9
Получил(а) "Спасибо": 0
Нарушения: 0/0 (0)
Репутация: 166
|
![]()
## файл site.ru.nginx.ssl.conf
server { listen 185.87.194.30:443; server_name site.ru www.site.ru; root /home/site/web/site.ru/public_html; index index.php index.html index.htm; access_log /var/log/nginx/domains/site.ru.log combined; access_log /var/log/nginx/domains/site.ru.bytes bytes; error_log /var/log/nginx/domains/site.ru.error.log error; ssl on; ssl_certificate /home/site/conf/web/ssl.site.ru.pem; ssl_certificate_key /home/site/conf/web/ssl.site.ru.key; location / { location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { expires max; } ## добавлено мною try_files $uri $uri/ /index.php?$args; ## location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9006; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } error_page 403 /error/404.html; error_page 404 /error/404.html; error_page 500 502 503 504 /error/50x.html; location /error/ { alias /home/site/web/site.ru/document_errors/; } location ~* "/\.(htaccess|htpasswd)$" { deny all; return 404; } location /vstats/ { alias /home/site/web/site.ru/stats/; include /home/site/conf/web/site.ru.auth*; } include /etc/nginx/conf.d/phpmyadmin.inc*; include /etc/nginx/conf.d/phppgadmin.inc*; include /etc/nginx/conf.d/webmail.inc*; include /home/site/conf/web/snginx.siteb.ru.conf*; } ## файл snginx.site.ru.conf_custom if ($host ~* ^(www\.site\.ru)$ ){ rewrite ^/(.*)$ https://site.ru/$1 permanent; } |
![]() |
![]() |
![]() |
#13 | |
Junior Member
Студент
Регистрация: 24.06.2020
Сообщений: 11
Сказал(а) спасибо: 9
Получил(а) "Спасибо": 0
Нарушения: 0/0 (0)
Репутация: 166
|
![]() Цитата:
server { listen 185.87.194.30:443; server_name site.ru www.site.ru; root /home/site/web/site.ru/public_html; index index.php index.html index.htm; access_log /var/log/nginx/domains/site.ru.log combined; access_log /var/log/nginx/domains/site.ru.bytes bytes; error_log /var/log/nginx/domains/site.ru.error.log error; ssl on; ssl_certificate /home/site/conf/web/ssl.site.ru.pem; ssl_certificate_key /home/site/conf/web/ssl.site.ru.key; location / { location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { expires max; } ## добавлено мною try_files $uri $uri/ /index.php?$args; ## location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9006; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } error_page 403 /error/404.html; error_page 404 /error/404.html; error_page 500 502 503 504 /error/50x.html; location /error/ { alias /home/site/web/site.ru/document_errors/; } location ~* "/\.(htaccess|htpasswd)$" { deny all; return 404; } location /vstats/ { alias /home/site/web/site.ru/stats/; include /home/site/conf/web/site.ru.auth*; } include /etc/nginx/conf.d/phpmyadmin.inc*; include /etc/nginx/conf.d/phppgadmin.inc*; include /etc/nginx/conf.d/webmail.inc*; include /home/site/conf/web/snginx.siteb.ru.conf*; } ## файл snginx.site.ru.conf_custom if ($host ~* ^(www\.site\.ru)$ ){ rewrite ^/(.*)$ https://site.ru/$1 permanent; } |
|
![]() |
![]() |
![]() |
#14 |
Junior Member
Студент
Регистрация: 24.06.2020
Сообщений: 11
Сказал(а) спасибо: 9
Получил(а) "Спасибо": 0
Нарушения: 0/0 (0)
Репутация: 166
|
![]()
Текущие конфиги:
## файл site.ru.nginx.ssl.conf server { listen 185.87.194.30:443; server_name site.ru www.site.ru; root /home/site/web/site.ru/public_html; index index.php index.html index.htm; access_log /var/log/nginx/domains/site.ru.log combined; access_log /var/log/nginx/domains/site.ru.bytes bytes; error_log /var/log/nginx/domains/site.ru.error.log error; ssl on; ssl_certificate /home/site/conf/web/ssl.site.ru.pem; ssl_certificate_key /home/site/conf/web/ssl.site.ru.key; location / { location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { expires max; } ## добавлено мною try_files $uri $uri/ /index.php?$args; ## location ~ [^/]\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9006; fastcgi_index index.php; include /etc/nginx/fastcgi_params; } } error_page 403 /error/404.html; error_page 404 /error/404.html; error_page 500 502 503 504 /error/50x.html; location /error/ { alias /home/site/web/site.ru/document_errors/; } location ~* "/\.(htaccess|htpasswd)$" { deny all; return 404; } location /vstats/ { alias /home/site/web/site.ru/stats/; include /home/site/conf/web/site.ru.auth*; } include /etc/nginx/conf.d/phpmyadmin.inc*; include /etc/nginx/conf.d/phppgadmin.inc*; include /etc/nginx/conf.d/webmail.inc*; include /home/site/conf/web/snginx.siteb.ru.conf*; } ## файл snginx.site.ru.conf_custom if ($host ~* ^(www\.site\.ru)$ ){ rewrite ^/(.*)$ https://site.ru/$1 permanent; } |
![]() |
![]() |
![]() |
#15 |
Junior Member
Студент
Регистрация: 24.06.2020
Сообщений: 11
Сказал(а) спасибо: 9
Получил(а) "Спасибо": 0
Нарушения: 0/0 (0)
Репутация: 166
|
![]() |
![]() |
![]() |
![]() |
#16 |
Junior Member
Студент
Регистрация: 27.07.2020
Сообщений: 22
Сказал(а) спасибо: 35
Получил(а) "Спасибо": 50
Нарушения: 0/0 (0)
Репутация: 21974
|
![]()
Не сильно понял обилие конфигов, но try_files в контексте location осуществляет свою деятельность
Код:
location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { # .........что там у вас для рнр |
![]() |
![]() |
Сказали спасибо: |
![]() |
Опции темы | |
|
|
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Закрыть доступ к wp-login.php на Nginx | wzp | Веб-строительство | 4 | 23.07.2020 22:37 |
Обновление nginx | -= Serafim =- | Веб-строительство | 8 | 22.07.2020 18:12 |