admin wrote: Wed Feb 01, 2023 10:17 pm
нет реврайтов
как же нет?
я вставил реврайты в шаблон для сайта
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
set $tcmsroot 'y';
location = /$tcmsroot/scj2.lic {
return 404;
}
location = /scj2.lic {
return 404;
}
location / {
if (!-e $request_filename) {
rewrite "^/([^/]{2})/(.*)$" /$2?force_lng=$1&$query_string ;
}
location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
}
}
location /gallery {
rewrite ^/gallery/([^/]+)/index.html$ /$tcmsroot/cgi/out.php?url=content&slug=$1&$query_string ;
rewrite "^/gallery/([^/]+)/([0-9]{1,2}).html$" /$tcmsroot/cgi/out.php?url=content&slug=$1&item_id=$2&$query_string ;
}
location /category {
rewrite ^/category/([^/]+)/$ /$tcmsroot/cgi/out.php?url=content&p=100&dont_count_in_trade=true&skip_sell=true&group_name=$1&order=ctr&$query_string ;
rewrite ^/category/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/cgi/out.php?url=content&p=100&dont_count_in_trade=true&skip_sell=true&group_name=$1&order=$2&page=$3&$query_string ;
}
location /tag {
rewrite ^/tag/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?tag=$1&page=$3&order=$2&$query_string ;
rewrite ^/tag/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?tag=$1&page=$2&$query_string ;
rewrite ^/tag/([^/]+)/$ /$tcmsroot/tube/index.php?tag=$1&$query_string ;
}
location /model_galleries {
rewrite ^/model_galleries/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&force_template=model_galleries ;
rewrite ^/model_galleries/([^/]+)/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&page=$2&force_template=model_galleries ;
}
location /model {
rewrite ^/model/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&force_template=model_galleries&$query_string ;
rewrite ^/model/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&force_template=model_galleries&order=$2&page=$3&$query_string ;
}
location /search {
rewrite ^/search/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?search=$1&page=$2&$query_string;
rewrite ^/search/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?search=$1&order=$2&page=$3&$query_string;
}
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~ /\.(?!well-known\/) {
deny all;
return 404;
}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}
вот конфиг
/etc/nginx/conf.d/domains/shop.life.conf
server {
listen 65.777.33.92:80;
server_name shop.life
www.shop.life;
root /home/user/web/shop.life/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/shop.life.log combined;
access_log /var/log/nginx/domains/shop.life.bytes bytes;
error_log /var/log/nginx/domains/shop.life.error.log error;
include /home/user/conf/web/shop.life/nginx.forcessl.conf*;
set $tcmsroot 'y';
location = /$tcmsroot/scj2.lic {
return 404;
}
location = /scj2.lic {
return 404;
}
location / {
if (!-e $request_filename) {
rewrite "^/([^/]{2})/(.*)$" /$2?force_lng=$1&$query_string ;
}
location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/run/php/php7.4-fpm-shop.life.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
include /home/user/conf/web/shop.life/nginx.fastcgi_cache.conf*;
}
}
location /gallery {
rewrite ^/gallery/([^/]+)/index.html$ /$tcmsroot/cgi/out.php?url=content&slug=$1&$query_string ;
rewrite "^/gallery/([^/]+)/([0-9]{1,2}).html$" /$tcmsroot/cgi/out.php?url=content&slug=$1&item_id=$2&$query_string ;
}
location /category {
rewrite ^/category/([^/]+)/$ /$tcmsroot/cgi/out.php?url=content&p=100&dont_count_in_trade=true&skip_sell=true&group_name=$1&order=ctr&$query_string ;
rewrite ^/category/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/cgi/out.php?url=content&p=100&dont_count_in_trade=true&skip_sell=true&group_name=$1&order=$2&page=$3&$query_string ;
}
location /tag {
rewrite ^/tag/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?tag=$1&page=$3&order=$2&$query_string ;
rewrite ^/tag/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?tag=$1&page=$2&$query_string ;
rewrite ^/tag/([^/]+)/$ /$tcmsroot/tube/index.php?tag=$1&$query_string ;
}
location /model_galleries {
rewrite ^/model_galleries/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&force_template=model_galleries ;
rewrite ^/model_galleries/([^/]+)/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&page=$2&force_template=model_galleries ;
}
location /model {
rewrite ^/model/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&force_template=model_galleries&$query_string ;
rewrite ^/model/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/tube/?model_slug=$1&force_template=model_galleries&order=$2&page=$3&$query_string ;
}
location /search {
rewrite ^/search/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?search=$1&page=$2&$query_string;
rewrite ^/search/([^/]+)/([^/]+)/([^/]+)/$ /$tcmsroot/tube/index.php?search=$1&order=$2&page=$3&$query_string;
}
location /error/ {
alias /home/user/web/shop.life/document_errors/;
}
location ~ /\.(?!well-known\/) {
deny all;
return 404;
}
location /vstats/ {
alias /home/user/web/shop.life/stats/;
include /home/user/web/shop.life/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /home/user/conf/web/shop.life/nginx.conf_*;
}
тоже самое в
/home/user/conf/web/shop.life/nginx.conf
урл на сайте на выходе вот такой
http://shop.life/gallery/lonely-housewi ... index.html
в итоге клики ведут на 404