Перейти к содержанию

UovoU

Пользователь
  • Постов

    7
  • Зарегистрирован

  • Посещение

Информация о UovoU

Достижения UovoU

Начинающий

Начинающий (2/14)

  • Первые шаги
  •  Неделю с Нами
  •  Уже Месяц

Полученные значки

1

Репутация

  1. 100napb, попробовал ваш вариант, вроде все работает без ошибок, если найду ошибки то отпишусь в теме. Большое вам спасибо!
  2. Разработчик модуля говорит что это не верная настройка config nginx. Если ставлю обработчик PHP CGI 7.3 то все работает так что дело не в модуле. В том то и дело что мне нужно именно с префиксами.
  3. Но теперь фаилы которые есть на сервере, выдают ошибку 403 https://test.ru/config.php https://test.ru/admin/config.php https://test.ru/system/modification.xml А фаилы которых нет выдают в OpenCart "Запрашиваемая страница не найдена!" https://test.ru/admin/1.php https://test.ru/admin/1.txt https://test.ru/admin/1.log https://test.ru/admin/1.xml В статье написано что все страницы должны выдавать ошибку "403 Forbidden", вне зависимости от того, есть файл по указанному пути на сервере, или нет.
  4. Убрал в своем конфиге и все заработало location / { ................ } Получается в статье ошибка, не нужно все параметры ставить в location / {.........} Все параметры должны быть в server {.........}
  5. Я пробовал вставлять строчку: location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } } Вместо нее у меня код как описано в статье выше: location ~ ^/(index|admin/index|install/index)\.php {try_files /does_not_exists @php;} Моя проблема в том что у меня на сайте 2 языка и добавлена приставка ru и en для разных языков. Из-за этого такие ссылки не открываются и выдают ошибку 404 если с вашем кодом или 403 если с кодом как в статье: domain.ru/ru/index.php?route=common/currency/currency domain.ru/en/index.php?route=common/currency/currency Если убираю приставку ru и en то все работает. domain.ru/index.php?route=common/currency/currency - такая ссылка открывается. Еще пример: domain.ru/ru/index.php?route=information/information&information_id=4 - не открывается, выдает ошибку 404 Если убираю приставку ru то domain.ru/index.php?route=information/information&information_id=4 открывается Вот полный код: server { server_name domain.ru www.domain.ru; charset off; index index.php index.html; disable_symlinks if_not_owner from=$root_path; include /etc/nginx/vhosts-includes/*.conf; include /etc/nginx/vhosts-resources/domain.ru/*.conf; access_log /var/www/httpd-logs/domain.ru.access.log; error_log /var/www/httpd-logs/domain.ru.error.log notice; set $root_path /var/www/user/data/www/domain.ru; root $root_path; location / { if ($http_host ~ "^domain.ru"){rewrite ^(.*)$ https://www.domain.ru$1 redirect;} if (!-e $request_filename){rewrite ^/(.+)$ /index.php?_route_=$1 last;} location ~ ^/(index|admin/index|install/index)\.php {try_files /does_not_exists @php;} location ~* \.(php|log|tpl|txt|twig|xml|ini)$ {deny all;} location ~ /\. {deny all;} location ~ ^/system/ {deny all;} location = /robots.txt {allow all;} location = /sitemap.xml {allow all; rewrite ^/(.*)$ /index.php?route=extension/feed/google_sitemap last;} location ~* ^.+\.(jpg|jpeg|gif|png|svg|ico|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {expires 365d;} if ($query_string ~ "^(.*)&?page=1$"){rewrite ^/(.*)/?$ /$1?%1%2 redirect;} } location @php { fastcgi_index index.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f admin@domain.ru"; fastcgi_pass unix:/var/www/php-fpm/3.sock; fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; try_files $uri =404; include fastcgi_params; } return 301 https://$host:443$request_uri; listen 185.197.160.88:80; } server { server_name domain.ru www.domain.ru; ssl_certificate "/var/www/httpd-cert/user/domain.ru_le1.crtca"; ssl_certificate_key "/var/www/httpd-cert/user/domain.ru_le1.key"; ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_dhparam /etc/ssl/certs/dhparam4096.pem; charset off; index index.php index.html; disable_symlinks if_not_owner from=$root_path; include /etc/nginx/vhosts-includes/*.conf; include /etc/nginx/vhosts-resources/domain.ru/*.conf; access_log /var/www/httpd-logs/domain.ru.access.log; error_log /var/www/httpd-logs/domain.ru.error.log notice; set $root_path /var/www/user/data/www/domain.ru; root $root_path; location / { if ($http_host ~ "^domain.ru"){rewrite ^(.*)$ https://www.domain.ru$1 redirect;} if (!-e $request_filename){rewrite ^/(.+)$ /index.php?_route_=$1 last;} location ~ ^/(index|admin/index|install/index)\.php {try_files /does_not_exists @php;} location ~* \.(php|log|tpl|txt|twig|xml|ini)$ {deny all;} location ~ /\. {deny all;} location ~ ^/system/ {deny all;} location = /robots.txt {allow all;} location = /sitemap.xml {allow all; rewrite ^/(.*)$ /index.php?route=extension/feed/google_sitemap last;} location ~* ^.+\.(jpg|jpeg|gif|png|svg|ico|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {expires 365d;} if ($query_string ~ "^(.*)&?page=1$"){rewrite ^/(.*)/?$ /$1?%1%2 redirect;} } location @php { fastcgi_index index.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f admin@domain.ru"; fastcgi_pass unix:/var/www/php-fpm/3.sock; fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; try_files $uri =404; include fastcgi_params; } listen 185.197.160.88:443 ssl; }
  6. Спасибо за статью. Очень хорошая статья, у меня все получилось настроить но при такой настройке не работают ссылки /ru/index.php?route=common/currency/currency выдает ошибку 403 У меня на сайте 2 языка и добавлена приставка ru и en для разных языков. Если убираю приставку то все работает. Помогите пожалуйста
×
×
  • Создать...