Pretty simple:
server {
listen 80;
server_name www.example.com;
rewrite ^(.*)$ $scheme://example.com$1;
}
server {
listen 80;
server_name example.com;
root /var/www/example;
index index.php;
access_log /var/log/nginx/example.access.log main;
#deny access to protected directories
# prevent nginx from serving dotfiles (.htaccess, .svn, .git, etc.)
location ~ /\. { deny all; access_log off; log_not_found off; }
#location = /favicon.ico { log_not_found off; access_log off; }
#avoid processing of calls to unexisting static files by yii
location ~ (js|css|png|jpg|gif|ico|pdf|zip|rar)$ { try_files $uri =404;}
location ~* \.(ico|css|js|gif|jpe?g|png|swf)$ {expires 30d; access_log off; }
location / {
#auth_basic "Access";
#auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://localhost:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
No comments:
Post a Comment