根 ( http://www.example.com/ ) 将指向 /var/www/wordpress
我怎样才能让每个人都可以在浏览器中查看?
working -- http://www.example.com
error -- http://www.example.com/wordpress2
error -- http://www.example.com/htmlsite
Run Code Online (Sandbox Code Playgroud)
这是结构:
first wordpress: /var/www/wordpress
second wordpress: /var/www/wordpress2
static html page: /var/www/htmlsite
server {
root /var/www/wordpress;
index index.php;
...
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /wordpress2 {
root /var/www/wordpress2;
try_files $uri $uri/ /index.php$is_args$args;
}
location /htmlsite {
root /var/www/htmlsite;
try_files $uri $uri/ =404;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我这样做root /var/www;
,那么 /wordpress2 和 /wordpress3 可以工作:
server {
root /var/www;
index index.php;
...
location / …
Run Code Online (Sandbox Code Playgroud) nginx ×1