我想在nginx中设置子目录。像
我当前的nginx配置是
upstream nodeproxy{
server 127.0.0.1:3814;
}
upstream adminproxy{
server 127.0.0.1:3817;
}
server {
listen 443 ssl spdy;
server_name example.com;
location ~* \.(css|js|json|html|jpg|png|ico|eot|svg|ttf|woff|woff2)$ {
root /root/abc/;
}
location / {
proxy_pass http://nodeproxy;
}
location /admin/ {
proxy_pass http://adminproxy;
}
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_buffers 16 8k;
gzip_vary on;
}
我试着这样说但是它不起作用
upstream nodeproxy{
server 127.0.0.1:3814;
}
upstream adminproxy{
server 127.0.0.1:3817;
}
server {
listen 443 ssl spdy;
server_name example.com;
location ~* \.(css|js|json|html|jpg|png|ico|eot|svg|ttf|woff|woff2)$ {
root /root/abc/;
}
location / {
proxy_pass http://nodeproxy;
}
location /admin/ {
proxy_pass http://adminproxy;
}
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_buffers 16 8k;
gzip_vary on;
}
server {
listen 443 ssl spdy;
server_name example.com/mysite;
location ~* \.(css|js|json|html|jpg|png|ico|eot|svg|ttf|woff|woff2)$ {
root /root/mysite/;
}
location / {
proxy_pass http://nodeproxy;
}
location /admin/ {
proxy_pass http://adminproxy;
}
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
gzip_buffers 16 8k;
gzip_vary on;
}