在安裝完nginx服務后,url訪問的默認路徑是安裝的路徑html文件夾下的內容,如果需要指定自定義的路徑,需要配置nginx.conf文件內容,這樣通過url訪問就可以了,比如: http://127.0.0.1/ 對應的物理路徑 c:/a/b/c
修改配置文件:
- server {
- listen 80;
- server_name localhost;
- #charset koi8-r;
- #access_log logs/host.access.log main;
- location / {
- #這里設置你的實際路徑
- root /home/ftpuser/www/;
- index index.html index.htm;
- }
- }
重啟nginx再訪問,如果訪問提示 Nginx 403 Forbidden
需要在nginx.conf頭部加入一行
- user root;
重啟nginx再訪問,就可以正常訪問了