安裝nginx完畢後,用瀏覽器訪問但是沒有跳轉也沒有報錯?

nginx不能訪問的其中一種問題

本人在安裝nginx時遇到了一個錯誤,就是在安裝完畢測試訪問nginx時,瀏覽器只顯示加載,並沒有彈出拒絕訪問,看了網上的方法,關閉防火牆,查看端口號是否被佔用,結果都沒有問題,nginx還是不能訪問。

qcl@qcl-TM2019:/usr/local/nginx/sbin$ sudo ufw status
狀態:不活動

qcl@qcl-TM2019:/usr/local/nginx/sbin$ sudo netstat -ntpl 激活Internet連接
(僅服務器) Proto Recv-Q Send-Q Local Address Foreign Address
0.0.0.0:* LISTEN 18887/nginx: master

後來去了nginx安裝目錄下的logs查看:

cd /usr/local/nginx/logs

qcl@qcl-TM2019:/usr/local/nginx/logs$ dir
access.log error.log nginx.pid

這裏有一個error.logs,記錄了nginx的一些錯誤日誌,進去看看:

 sudo vim error.logs

74 ngx_http_fastdfs_process_init pid=17259
75 [2019-10-23 11:01:49] ERROR - file: shared_func.c, line: 1067, file /etc/fdfs/mod_fastdfs.conf not exist
76 [2019-10-23 11:01:49] ERROR - file: /home/qcl/fastdfs-nginx-module/src/common.c, line: 163, load conf file “/etc/fdfs/mod_fastdfs.conf” fail, ret code: 2
77 2019/10/23 11:01:49 [alert] 17258#0: worker process 17259 exited with fatal code 2 and cannot be respawned
78 2019/10/23 11:16:44 [notice] 18884#0: signal process started

重點在“ file /etc/fdfs/mod_fastdfs.conf not exist”,也就是所nginx在查找不到/etc/fdfs目錄下的mod_fastdfs.conf文件,我的Fastdfs的配置文件主要在/usr/etc/fdfs,結果把fastdfs-nginx-module/src裏面的mod_fastdfs.conf也複製到這裏了,導致nginx找不到中國文件。

那麼我們把mod_fastdfs.conf這個文件cp到/etc/fdfs下就好了:

cp /usr/etc/fdfs/mod_fastdfs.conf /etc/fdfs

或者

cp ~/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

另外http.conf和mime.types也是拷貝到/etc/fdfs下面

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章