Como configurar o nginx para pasta adm tratar como um outro servidor?
eu ja fiz isso com htaccess mas no nginx não estou conseguindo eu tentei como pode ver no arquivo mas nada
server {
listen 80 ;
charset utf-8;
# Make site accessible from [http://localhost/](http://localhost/)
server_name ~^(?<domain>.+)\.dev$;
root /vagrant/sites/$domain/public;
index index.html index.htm index.php index.phtml;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass [http://127.0.0.1:8080;](http://127.0.0.1:8080)
#}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /vagrant/sites/$domain/public;
}
location /admin {
root /vagrant/sites/$domain/public;
try_files $uri $uri $domain/index.php?$args $uri/index.php?$args;
}
location ~* \.(?:ico|css|js|gif|png|swf|pdf|mov|fla|zip|rar|jpe?g)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
try_files $uri =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.(php|phtml)$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
try_files $uri $uri/ /index.php?$args;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
sendfile off;
###############
# Habilita o gzip
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
# Mime-types que sero compactados
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# [http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl](http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl)
gzip_buffers 16 8k;
# Desabilita o gzip para alguns navegadores
gzip_disable "MSIE [1-6].(?!.*SV1)";
}server {
listen 80 ;
charset utf-8;
# Make site accessible from [http://localhost/](http://localhost/)
server_name ~^(?<domain>.+)\.dev/admin$;
root /vagrant/sites/$domain/public/admin;
index index.html index.htm index.php index.phtml;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass [http://127.0.0.1:8080;](http://127.0.0.1:8080)
#}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /vagrant/sites/$domain/public/admin;
}
location ~* \.(?:ico|css|js|gif|png|swf|pdf|mov|fla|zip|rar|jpe?g)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
try_files $uri =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.(php|phtml)$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
try_files $uri $uri/ /index.php?$args;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
sendfile off;
###############
# Habilita o gzip
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
# Mime-types que sero compactados
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# [http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl](http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl)
gzip_buffers 16 8k;
# Desabilita o gzip para alguns navegadores
gzip_disable "MSIE [1-6].(?!.*SV1)";
}Discussão (0)
Carregando comentários...