upstream {{ pj | replace("_","") }} { {% for each_host in deploy_host.split(',') %} server {{ each_host }}:{{ port }}; {% endfor %} } server { listen 80; listen 443 ssl; server_name {{ domain }}; index index.php index.html index.htm default.php default.htm default.html; root /data/wwwroot/{{ domain }}{{ php_nginx_root }}; access_log /data/logs/web/{{ domain }}-access.log json; error_log /data/logs/web/{{ domain }}-error.log; error_page 502 /502.html; underscores_in_headers on; location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php/?s=$1 last; break; } } location ~ [^/]\.php(/|$) { add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; try_files $uri =404; fastcgi_pass {{ pj | replace("_","") }}; fastcgi_index index.php; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; include fastcgi_params; } include enable-ssl.conf; location ~ ^/(\.user.ini|\.htaccess|\.git|\.project|LICENSE|README.md) { return 404; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 12h; access_log off; } }