使用Laravel php在非套接字nginx错误上进行套接字操作

时间:2017-12-30 23:57:52

标签: php macos sockets nginx

我只是想在我的OSX上运行nginx上的php。

设置

我的php-fpm.conf档案
我的www.conf档案 在我的nginx.conf文件中,我得到了这个:

Sub Copy_Cell()
    Dim row as Integer
    Do While row <= 337
        Sheets("Sheet A").Activate
        Sheets("Sheet A").Cells(row + 1, 1).Copy
        Sheets("Sheet B").Activate 
        Range("A2").Select
        ActiveSheet.Paste 
        ActiveWindow.SelectedSheets.PrintOut Copies:=1
        row = row + 1
    Loop
End sub

错误

每次我点击我的服务器时都会收到此错误:

  

2017/12/31 01:45:25 [暴击] 1102#0:* 2连接()到unix:/var/run/php-fpm.sock失败(38:非套接字上的套接字操作)连接到上游,client ::: 1,server:default,request:&#34; POST / api / users / login HTTP / 1.1&#34;,upstream:&#34; fastcgi:// unix:/ var / run / php-fpm.sock:&#34;,host:&#34; localhost:8000&#34;

我该怎么做才能解决这个问题?

更新

我意识到在我的 location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; } 里面我得到了这一行

php-fpm.d/www.conf

所以我更新了我的nginx conf文件:

listen = 127.0.0.1:9000

但现在我收到了这个错误:

  

2017/12/31 02:07:24 [错误] 1429#0:* 2在stderr发送的FastCGI:&#34;主要脚本未知&#34;从上游读取响应头时,client ::: 1,server:default,request:&#34; POST / api / users / login HTTP / 1.1&#34;,upstream:&#34; fastcgi://127.0。 0.1:9000&#34;,主持人:&#34; localhost:8000&#34;

更新3

来自this answer我将此添加到nginx conf:

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000; 
        fastcgi_index index.php;
        include fastcgi_params;
    }

fastcgi.conf有这个:

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000; 
        fastcgi_index index.php;
        include fastcgi.conf;
    }

但仍然是相同的错误消息

1 个答案:

答案 0 :(得分:0)

解决方案很简单.. nginx正在寻找我的index.php ..我提供了我的laravel项目的根目录,实际上我应该将公共指令放在laravel中,如下所示:

http {
    server {
        listen 8000 default_server;
        listen [::]:8000 default_server;
        server_name default;
        root /path/to/my/laravel/project/public/index.php; 
相关问题