nginx - mac 下搭建php環境出錯?

來源:互聯網
上載者:User

我的nginx 和php-fpm 都有啟動。但是仍然報錯,google後仍然無果,萬能的社區,求助啊!
查看資訊

設定檔如下:

報錯資訊如下:

回複內容:

我的nginx 和php-fpm 都有啟動。但是仍然報錯,google後仍然無果,萬能的社區,求助啊!
查看資訊

設定檔如下:

報錯資訊如下:

建議你每個項目定一個網域名稱 一個目錄

sudo vi /etc/hosts//添加127.0.0.1    demo.dev

開啟 /usr/local/etc/nginx/servers

然後建立一個設定檔 例如 demo.conf 內容如下:

server {    listen 80;    server_name demo.dev; #網域名稱    root /Users/程式目錄; #程式目錄    index index.html index.php;        # 偽靜態    #location / {    #    try_files $uri $uri/ /index.php$is_args$query_string;    #}    location ~ \.php$ {        try_files $uri =404;        fastcgi_pass 127.0.0.1:9000;        fastcgi_index index.php;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        include fastcgi_params;    }}

重啟nginx,瀏覽器訪問demo.dev 大功告成

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

試試。

server {    listen 80;    server_name localhost;    root /path; #注意這裡配置為你的網站根目錄    index index.html index.htm index.php;    location / {        #try_files $uri $uri/ /index.php$is_args$args;    }        location ~ \.php$ {        try_files $uri =404;        include fastcgi_params;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        fastcgi_pass 127.0.0.1:9000;        fastcgi_index index.php;    }}

建議還是vagrant在mac上面架設lnmp環境. 百度下有很多的解決方案

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.