解決部署Nginx專案出現的問題

2022-07-10 05:45:12 字數 1967 閱讀 3754

1,首先檢視防火牆狀態

命令:  systemctl  status firewalld

如果防火牆處於開啟狀態時,將防火牆關閉。

命令: systemctl stop firewalld

此時再次訪問專案的時候出現了403錯誤

一、由於啟動使用者和nginx工作使用者不一致所致

1.2將nginx.config的user改為和啟動使用者一致,

命令:vi conf/nginx.conf

二、缺少index.html或者index.php檔案,就是配置檔案中index index.html index.htm這行中的指定的檔案。

1.    server 

如果在/data/www/下面沒有index.php,index.html的時候,直接檔案,會報403 forbidden。

三、許可權問題,如果nginx沒有web目錄的操作許可權,也會出現403錯誤。

解決辦法:修改web目錄的讀寫許可權,或者是把nginx的啟動使用者改成目錄的所屬使用者,重啟nginx即可解決

1.    chmod -r 777 /data

2.    chmod -r 777 /data/www/

四、selinux設定為開啟狀態(enabled)的原因(最可能出現的原因)。

4.1、檢視當前selinux的狀態。

1.    /usr/sbin/sestatus

4.2、將selinux=enforcing 修改為 selinux=disabled 狀態。

1.    vi /etc/selinux/config

2.    #selinux=enforcing

3.    selinux=disabled

4、重啟生效。reboot。

5.    reboot

1,首先檢視防火牆狀態

命令:  systemctl  status firewalld

如果防火牆處於開啟狀態時,將防火牆關閉。

命令: systemctl stop firewalld

此時再次訪問專案的時候出現了403錯誤

一、由於啟動使用者和nginx工作使用者不一致所致

1.2將nginx.config的user改為和啟動使用者一致,

命令:vi conf/nginx.conf

二、缺少index.html或者index.php檔案,就是配置檔案中index index.html index.htm這行中的指定的檔案。

1.    server 

如果在/data/www/下面沒有index.php,index.html的時候,直接檔案,會報403 forbidden。

三、許可權問題,如果nginx沒有web目錄的操作許可權,也會出現403錯誤。

解決辦法:修改web目錄的讀寫許可權,或者是把nginx的啟動使用者改成目錄的所屬使用者,重啟nginx即可解決

1.    chmod -r 777 /data

2.    chmod -r 777 /data/www/

四、selinux設定為開啟狀態(enabled)的原因(最可能出現的原因)。

4.1、檢視當前selinux的狀態。

1.    /usr/sbin/sestatus

4.2、將selinux=enforcing 修改為 selinux=disabled 狀態。

1.    vi /etc/selinux/config

2.    #selinux=enforcing

3.    selinux=disabled

4、重啟生效。reboot。

5.    reboot

nginx 部署多個uwsgi 以及出現的問題

今天專案中,前端請求資料,需要同步進行,有時後端處理時間過長,造成超時,此時我的配置如下 nginx location pf uwsgi uwsgi http 10.100.100.40 8830以上是可以正常執行的,但是可以修改為以下 nginx location pf uwsgi uwsgi s...

nginx部署專案

yum install y nginx 設定開機啟動 systemctl start nginx.service systemctl enable nginx.service nginx預設使用埠 80,ecs例項沒有開啟埠80,預設只有 22 和 3389 將自己的vue專案 執行如下命令打包 c...

Linux 解決mysql安裝及部署專案問題

mysql是5.7版本 1.mysql無法啟動 systemctl restart mysql.service failed to restart mysql.service unit not found.發現啟動mysql服務,還差乙個dmysqld.service 重啟mysql服務 syste...