RewriteCond %{REQUEST_URI} !^/dir1/
RewriteCond %{REQUEST_URI} !^/dir2/
RewriteRule ^([^/]+)/$ index.php?x=$1 [L]
При добавлении следующего кода в начало файла /etc/nginx/conf.d/site1.conf возникает ошибка и сервер падает.
server_name *.*;
location /api/ {
proxy_pass http://127.0.0.1:8000;
app.get("/catalog",
location /api/ {
proxy_pass http://127.0.0.1:8000/;
Если директива proxy_pass указана с URI, то при передаче запроса серверу часть нормализованного URI запроса, соответствующая location, заменяется на URI, указанный в директиве:
location /name/ { proxy_pass http://127.0.0.1/remote/; }
map $args $conf {
volatile;
default "conf.js";
"~(^|&)arg1=" "conf2.js";
}
server {
location = /RCQSHbKFtFPCqkhPSYBccCktLL9juFHvg7ZmL {
alias /config/$conf;
}
location ~ \.php
/some/data
.rewrite ^ /index.php$uri;
выполнит перенаправление на /index.php/some/data
.location ~ \.php
потом ещё добавляют fastcgi_split_path_info и fastcgi_param PATH_INFO '(.*)'>
ищет кавычку за которой сразу идёт символ >
. Вот в этом и была проблема. Так что если убрать этот лишний символ, то и с ungreed будет нормально работать.server {
listen 80;
listen [::]:80;
server_name mydomain.com www.mydomain.com;
return 301 https://mydomain.com$request_uri;
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
server_name www.mydomain.com;
return 301 https://mydomain.com$request_uri;
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
server_name mydomain.com;
root /var/www/vanilla;
index index.php;
location ~* /\.git { deny all; return 403; }
location /build/ { deny all; return 403; }
location /cache/ { deny all; return 403; }
location /cgi-bin/ { deny all; return 403; }
location /uploads/import/ { deny all; return 403; }
location /conf/ { deny all; return 403; }
location /tests/ { deny all; return 403; }
location /vendor/ { deny all; return 403; }
location ~* ^/index\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
fastcgi_param X_REWRITE 1;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~* \.php(/|$) {
rewrite ^ /index.php$uri last;
}
location / {
try_files $uri $uri/ @vanilla;
}
location @vanilla {
rewrite ^ /index.php$uri last;
}
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
server_name mydomain.com www.mydomain.com;
root /var/www/vanilla;
index index.php;
location ~* /\.git { deny all; return 403; }
location /build/ { deny all; return 403; }
location /cache/ { deny all; return 403; }
location /cgi-bin/ { deny all; return 403; }
location /uploads/import/ { deny all; return 403; }
location /conf/ { deny all; return 403; }
location /tests/ { deny all; return 403; }
location /vendor/ { deny all; return 403; }
location ~* ^/index\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
fastcgi_param X_REWRITE 1;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~* \.php(/|$) {
rewrite ^ /index.php$uri last;
}
location / {
try_files $uri $uri/ @vanilla;
}
location @vanilla {
rewrite ^ /index.php$uri last;
}
}
Для бэкенда нужно организовать два разных локейшена с разными client_max_body_size.