server {
listen 01.23.45.67:443 ssl http2;
server_name site.com www.site.com;
root /home/user/workspace/sites/site.com;
if ($http_host ~ "^www\.(.*)$"){
set $http_host_1 $1;
rewrite ^(.*)$ https://$http_host_1/$1 redirect;
}
# ssl on;
ssl_certificate /etc/certs/user/site.com_10-07-2020_11:03:44_letencrypt.crt_v2;
ssl_certificate_key /etc/certs/user/site.com_10-07-2020_11:03:44_letencrypt.key;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers "HIGH:!RC4:!aNULL:!MD5:!kEDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:!COMPLEMENTOFDEFAULT;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security 'max-age=604800';
access_log /etc/nginx/vhost_logs/site.com_access;
error_log /etc/nginx/vhost_logs/site.com_error;
location ~ /.well-known { allow all; }
# location ~* robots.txt { root /etc/nginx; }
location ~ /\.ht {
deny all;
access_log off;
log_not_found off;
}
location / {
root /home/user/workspace/sites/site.com;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location ~ \.php$ {
try_files $fastcgi_script_name =404;
root /home/user/workspace/sites/site.com;
#fastcgi_pass localhost:9009;
fastcgi_pass unix:/var/run/php-fpm/php72w-user.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/user/workspace/sites/site.com$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /home/user/workspace/sites/site.com$fastcgi_script_name;
fastcgi_buffers 8 64k;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_connect_timeout 120;
fastcgi_read_timeout 900;
fastcgi_send_timeout 900;
fastcgi_cache off;
fastcgi_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
fastcgi_cache_valid 200 10s;
limit_conn lfcgi 50;
#fastcgi_param SCRIPT_FILENAME /workspace/sites/site.com$fastcgi_script_name;
#fastcgi_param PATH_TRANSLATED /workspace/sites/site.com$fastcgi_script_name;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
}
# error_page 404 /404.html;
# location = /40x.html {
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
}
RewriteRule ^page/([0-9]+)/$ index.php?page=$1 [L,QSA]
RewriteRule ^cat/([0-9]+)/(.*)/([0-9]+)/$ cat.php?id=$1&name=$2&page=$3 [L,QSA]
RewriteRule ^cat/([0-9]+)/(.*)/$ cat.php?id=$1&name=$2 [L,QSA]
RewriteRule ^collections/$ collections.php [L,QSA]
RewriteRule ^collections/([0-9]+)/$ collections.php?page=$1 [L,QSA]
RewriteRule ^search/(.*)/([0-9]+)/$ search.php?q=$1&page=$2 [L,QSA]
RewriteRule ^search/(.*)/$ search.php?q=$1 [L,QSA]
rewrite ^/page/([0-9]+)/$ /index.php?page=$1 last;
rewrite ^/cat/([0-9]+)/(.*)/([0-9]+)/$ /cat.php?id=$1&name=$2&page=$3 last;
rewrite ^/cat/([0-9]+)/(.*)/$ /cat.php?id=$1&name=$2 last;
rewrite ^/collections/$ /collections.php last;
rewrite ^/collections/([0-9]+)/$ /collections.php?page=$1 last;
rewrite ^/search/(.*)/([0-9]+)/$ /search.php?q=$1&page=$2 last;
rewrite ^/search/(.*)/$ /search.php?q=$1 last;