server {
listen 123.123.123.123:80 default_server;
server_name 123.com www.123.com;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset off;
index index.php index.html;
set $root_path /var/www/www-root/data/www/123.com/public;
root $root_path;
disable_symlinks if_not_owner from=$root_path;
access_log /var/www/httpd-logs/123.com.access.log;
error_log /var/www/httpd-logs/123.com.error.log notice;
error_page 404 /index.php;
location / {
return 301 https://$host$request_uri;
}
location ~ ^/(bouns)?$ {
fastcgi_param SCRIPT_FILENAME $root_path/index.php;
fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
include fastcgi_params;
}
}
location / {
resolver 8.8.8.8;
proxy_pass http://$arg_url;
add_header Access-Control-Allow-Origin *;
}
RewriteCond %{CF-Connecting-IP} ^XXX.YY.* RewriteCond %{X-Real-IP} ^XXX.YY.*
RewriteCond %{HTTP:CF-Connecting-IP} !^XXX\.YY\.
RewriteCond %{HTTP:X-Real-IP} !^XXX\.YY\.
RewriteEngine On
RewriteCond %{HTTP:X-Real-IP} !^XXX\.YY\.
RewriteRule (.*) - [F]
server { server_name www.example.com; listen *:80; listen [::]:80 ipv6only=on; if ($uri !~* ^/downloads/(.+)$) { return 301 https://example.com/downloads/$1; } }
if
лучше использовать location.server {
server_name example.com www.example.com;
listen *:80;
listen [::]:80 ipv6only=on;
location / {
return 301 https://example.com$request_uri;
}
location /downloads/ {
root /var/www/html;
}
}
location ~ ^/i/imgs?/(.*)$ {
resolver 8.8.8.8;
proxy_pass https://$1;
}
location ~ ^/i/imgs?/img\.site2\.ru/(.*)$ {
proxy_pass https://img.site2.ru/$1;
}
server {
listen 80;
listen [::]:80; #Added IPv6 here too
# for certbot
location ^~ /.well-known/acme-challenge/ {
root /etc/nginx/ssl/coins;
}
location / {
return 301 https://my.cryptonot.io$request_uri;
}
}
rewrite ^/index$ / permanent;
rewrite ^(.+)/index$ $1 permanent;
rewrite ^/((.+)/)?index$ /$2 permanent;
location ~ \.php$ {
try_files $uri =404;
location ~ ^/(.*\.php)$ {
try_files $uri /index.php?_route_=$1;
server {
listen *:12901;
server_name test.lan;
location / {
proxy_pass http://lan_nodes;
//....
}
location ~ ^/static/.*\.(jpg|jpeg|gif|png|webp|ico|css|bmp|swf|js|html|txt|ejs|json)$ {
root /test/vendor;
expires 10d;
}
location ~ \.(jpg|jpeg|gif|png|webp|ico|css|bmp|swf|js|html|txt|ejs|json)$ {
root /test/app/dist/images;
expires 10d;
}
}