nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:57


/************************************************************************************************
 *  nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:57
 * 說明:
 *     VPS安裝Ubuntu 16.04,調一下Nginx的PHP Server。
 *
 *                                              2017-9-26 深圳 龍華樟坑村 曾劍鋒
 **********************************************************************************************/

一、參考文檔:
    1. 啟動 nginx 失敗 "fastcgi_pass" directive is duplicate
        http://www.cnblogs.com/cgjcgs/p/5310031.html

二、錯誤現象:
    root@localhost:/var/www/html# systemctl status nginx.service
    鈼?[0m nginx.service - A high performance web server and a reverse proxy server
       Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Tue 2017-09-26 01:45:11 EDT; 1min 20s ago
      Process: 345 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

    Sep 26 01:45:11 localhost systemd[1]: Starting A high performance web server and a reverse proxy server...
    Sep 26 01:45:11 localhost nginx[345]: nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:57
    Sep 26 01:45:11 localhost nginx[345]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Sep 26 01:45:11 localhost systemd[1]: nginx.service: Control process exited, code=exited status=1
    Sep 26 01:45:11 localhost systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    Sep 26 01:45:11 localhost systemd[1]: nginx.service: Unit entered failed state.
    Sep 26 01:45:11 localhost systemd[1]: nginx.service: Failed with result 'exit-code'.

三、解決辦法:
    1. 修改文件:/etc/nginx/sites-enabled/default
    2. 如下:
        location ~ \.php$ {
            ...
            #    fastcgi_pass 127.0.0.1:9000; (此處和下面重復,注釋掉)
            #    # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;(此處和上面重復)
            ...
        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM