Nginx更改文档根目录
我正在使用来自的Windows安装文件 但是它不允许更改安装位置,因此它默认为Nginx更改文档根目录,nginx,Nginx,我正在使用来自的Windows安装文件 但是它不允许更改安装位置,因此它默认为C:\nginx是否有方法更新配置文件以将根目录更改为D:\blabla 来自nginx.conf server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } #error_page 404
C:\nginx
是否有方法更新配置文件以将根目录更改为D:\blabla
来自nginx.conf
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
启动nginx时使用
-p
参数:
nginx -p "D:\blabla"
根目录d:/path/where;
将工作没有问题,但一定要使用正确的windows版本,如Butterfly或Caterpillar版本,而不是其他残缺的版本
甚至是根“//192.168.2.5/mount/webdrive”;
会有用的 我不知道两年前的情况如何,但对于当前版本(1.13.9),您只需设置服务器的根目录即可
server {
listen 80;
server_name localhost;
location / {
root D:\blabla;
index index.html index.htm;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root D:\blabla;
}
}