https://blog.engineyard.com/2011/useful-rewrites-for-nginx
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
http://www.yiiframework.com/forum/index.php/topic/29830-yii-nginx-urlmanager/
--------------------------------------------------------------------------------------------------------------------------
server {
listen 443 default_server ssl;
server_name wifinext wifinext.mydomain.com;
rewrite ^/$ /mgmt/ permanent;
server_tokens off;
ssl_certificate /dati/com.crt;
ssl_certificate_key /dati/com.key;
ssl_client_certificate /dati/gd_bundle.crt;
ssl_session_timeout 5m;
keepalive_timeout 70;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
root /dati/mydomain/www/management_site;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
index index.php index.html;
root /dati/mydomain/www/management_site;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
root /dati/mydomain/www/management_site;
}
## Parse all .php file in the /var/www directory
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_param HTTPS on;
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi_params_yetopen;
}
location ~ /\.ht {
deny all;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass backend;
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi_params_yetopen;
fastcgi_param HTTPS on;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
}
--------------------------------------------------------------------------------------------------------------------------
Standard Yii config vhost nginx
server {
set $host_path "/www/mysite";
access_log /www/mysite/log/access.log main;
server_name mysite;
root $host_path/htdocs;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
# prevent nginx from serving dotfiles (.htaccess, .svn, .git, etc.)
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
--------------------------------------------------------------------------------------------------------------------------
http://siawyoung.com/coding/sysadmin/nginx/downloading-and-installing-nginx.html
http://kx.cloudingenium.com/linux/ubuntu/build-version-nginx/
https://www.nginx.com/resources/wiki/start/topics/examples/full/
dam it :
# location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
# }
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
http://www.yiiframework.com/forum/index.php/topic/29830-yii-nginx-urlmanager/
--------------------------------------------------------------------------------------------------------------------------
server {
listen 443 default_server ssl;
server_name wifinext wifinext.mydomain.com;
rewrite ^/$ /mgmt/ permanent;
server_tokens off;
ssl_certificate /dati/com.crt;
ssl_certificate_key /dati/com.key;
ssl_client_certificate /dati/gd_bundle.crt;
ssl_session_timeout 5m;
keepalive_timeout 70;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
root /dati/mydomain/www/management_site;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
index index.php index.html;
root /dati/mydomain/www/management_site;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
root /dati/mydomain/www/management_site;
}
## Parse all .php file in the /var/www directory
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_param HTTPS on;
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi_params_yetopen;
}
location ~ /\.ht {
deny all;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass backend;
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi_params_yetopen;
fastcgi_param HTTPS on;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
}
--------------------------------------------------------------------------------------------------------------------------
Standard Yii config vhost nginx
server {
set $host_path "/www/mysite";
access_log /www/mysite/log/access.log main;
server_name mysite;
root $host_path/htdocs;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
# prevent nginx from serving dotfiles (.htaccess, .svn, .git, etc.)
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
--------------------------------------------------------------------------------------------------------------------------
http://siawyoung.com/coding/sysadmin/nginx/downloading-and-installing-nginx.html
http://kx.cloudingenium.com/linux/ubuntu/build-version-nginx/
https://www.nginx.com/resources/wiki/start/topics/examples/full/
dam it :
# location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
# }
Comments
Post a Comment