Answer the question
In order to leave comments, you need to log in
How to combine 2 nginx rules?
How to combine these 2 rules?
location / {
try_files $uri $uri/ /index.php?$args;
location ~* (siteadmin|catalog) {
auth_basic "Restricted";
auth_basic_user_file /home/sitemarket/conf/web/.htpasswd;}
server {
listen ip:443;
server_name site.kg www.site.kg;
root /home/sitemarket/web/site.kg/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/site.kg.log combined;
access_log /var/log/nginx/domains/site.kg.bytes bytes;
error_log /var/log/nginx/domains/site.kg.error.log error;
if ($http_host = www.site.kg) {
rewrite (.*) https://site.kg$1;
}
ssl on;
ssl_certificate /home/sitemarket/conf/web/ssl.site.kg.pem;
ssl_certificate_key /home/sitemarket/conf/web/ssl.site.kg.key;
....
..........
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires site;
}
location ~* (siteadmin|catalog) {
auth_basic "Restricted";
auth_basic_user_file /home/sitemarket/conf/web/.htpasswd;}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_read_timeout 3000;
..............
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/sitemarket/web/site.kg/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/sitemarket/web/site.kg/stats/;
include /home/sitemarket/conf/web/site.kg.auth*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/sitemarket/conf/web/snginx.site.kg.conf*;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question