重新启动 nginx nginx [失败]

Restarting nginx nginx [fail]

当我在 Vagrant 上尝试 运行 时:

serve damcapp /home/vagrant/Projects/dmca-app

我收到这个错误:

dos2unix: converting file /vagrant/scripts/serve.sh to Unix format ...
 * Restarting nginx nginx        [fail] 
php5-fpm stop/waiting
php5-fpm start/running, process 3846

我已经读了很多关于它的文章并且我检查过:

sudo nginx -t

我得到了:

nginx: [emerg] invalid number of arguments in "listen" directive in /etc/nginx/sites-enabled/damcapp:2
nginx: configuration file /etc/nginx/nginx.conf test failed

我在这个文件中尝试使用端口 80:

server {
    listen 80(**I added here**);
    server_name damcapp;
    root "/home/vagrant/Projects/dmca-app";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/damcapp-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
     }

     location ~ /\.ht {
       deny all;
     }
}

此外,我注意到此文件的路径是 /etc/nginx/sites-enabled/damcapp注意我的应用程序的最终名称不同 dmca- app,不知道对不对,不对怎么改?)。 更新后再次尝试服务命令,nginx 再次失败。即使我尝试了类似于 Laravel 5 文档

serve damcapp /home/vagrant/Projects/dmca-app 80

在决赛中加了 80 分,但我一无所获。如果我再次尝试查看 /etc/nginx/sites-enabled/dam​​capp,80 号码已经消失。 最后,我尝试编辑我的 ~/.homestead/aliases 文件,在这一行中添加 80:

sudo bash /vagrant/scripts/serve.sh "" "" 80

什么也没有。当我需要一个新站点但删除之前创建的数据时,我一直在使用 homestead provision。我有点沮丧。 请有任何建议。 亲切的问候。

我解决问题的唯一方法是: homestead destroy and homestead up... 我再次尝试使用 serve 命令,一切正常。

您可能一开始就没有 Nginx 实例 运行