Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 80;
- listen 443 ssl;
- ssl_certificate /etc/nginx/example.com_cert.pem;
- ssl_certificate_key /etc/nginx/example.com_privkey.pem;
- root /usr/share/nginx/www/example.com;
- index index.html index.php;
- server_name example.com www.example.com;
- if ($http_host != "www.example.com") {
- rewrite ^ $scheme://www.example.com$request_uri permanent;
- }
- location / {
- # First attempt to serve request as file, then
- # as directory, then fall back to displaying a 404.
- try_files $uri $uri/ =404;
- # Uncomment to enable naxsi on this location
- # include /etc/nginx/naxsi.rules
- }
- # Serve an empty 1x1 gif _OR_ an error 204 (No Content) for favicon.ico
- location = /favicon.ico {
- #empty_gif;
- return 204;
- }
- location ~ \.php$ {
- try_files $uri =404;
- include /etc/nginx/fastcgi_params;
- fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- }
- }
- server {
- listen 80;
- listen 443 ssl;
- ssl_certificate /etc/nginx/example.com_cert.pem;
- ssl_certificate_key /etc/nginx/example.com_privkey.pem;
- server_name static.example.com;
- root /usr/share/nginx/www/example.com/static;
- location / {
- if ($request_filename ~ "\.(jpg|jpeg|css|gif|png)$") {
- break;
- }
- return 404;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement