-
-
Save reltonfidelisdev/6574a61d28501295cd902f46df514b3f to your computer and use it in GitHub Desktop.
nginx vhost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name site.local; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name site.local; | |
ssl on; | |
ssl_certificate /etc/ssl/certs/snakeoil.pem; | |
ssl_certificate_key /etc/ssl/private/snakeoil.key; | |
access_log /var/log/nginx/site-access.log; | |
error_log /var/log/nginx/site-error.log; | |
root /srv/http/site/web; | |
if ($ssl_protocol = "") { | |
rewrite ^ https://$server_name$request_uri? permanent; | |
} | |
location / { | |
try_files $uri @php_index; | |
} | |
location ~ /\. { | |
deny all; | |
} | |
location ~* ^/assets/ { | |
# don't log requests | |
access_log off; | |
# Per RFC2616 - 1 year maximum expiry | |
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html | |
expires 1y; | |
add_header Cache-Control public; | |
# Some browsers still send conditional-GET requests if there's a | |
# Last-Modified header or an ETag header even if they haven't | |
# reached the expiry date sent in the Expires header. | |
add_header Last-Modified ""; | |
add_header ETag ""; | |
break; | |
} | |
location @php_index { | |
#fastcgi_pass 127.0.0.1:9000; | |
fastcgi_pass unix:/run/php-fpm/php-fpm.sock; | |
#fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root/index.php; | |
fastcgi_param YII_DEBUG true; | |
fastcgi_param YII_ENV dev; | |
#fastcgi_read_timeout 3600; | |
include fastcgi_params; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment