![如何在 nginx 中将根目录/指向子目录](https://linux22.com/image/1587230/%E5%A6%82%E4%BD%95%E5%9C%A8%20nginx%20%E4%B8%AD%E5%B0%86%E6%A0%B9%E7%9B%AE%E5%BD%95%2F%E6%8C%87%E5%90%91%E5%AD%90%E7%9B%AE%E5%BD%95.png)
目前我的 webroot 是http://example.com指向/var/www/example.com/
我想将 WP 安装从那里移动到子文件夹(即/var/www/example.com/int/
)并将 webroot 指向该子文件夹,以便网站 URL 保留相同。
这是我的服务器配置,但它不起作用。你能给我一些建议吗?
server {
root /var/www/example.com;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com;
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(woff|eot|ttf|svg|mp4|webm|jpg|jpeg|png|gif|ico|css|js|otf)$ {
expires 1d;
log_not_found off;
access_log off;
}
location / {
root /var/www/example.com/int;
}
}