【问题标题】:Restarting nginx nginx [fail]重启 nginx nginx [失败]
【发布时间】:2015-05-15 16:30:11
【问题描述】:

当我尝试在 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/damcapp 80 数字已经消失。 最后我尝试编辑我的 ~/.homestead/aliases 文件,在这一行添加 80:

sudo bash /vagrant/scripts/serve.sh "$1" "$2" 80

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

【问题讨论】:

  • 我刚刚编辑了帖子,我把所有的配置文件。

标签: nginx vagrant laravel-5


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2017-05-16
      • 1970-01-01
      • 2016-04-11
      • 1970-01-01
      • 2011-06-18
      • 2023-03-19
      • 1970-01-01
      • 2017-04-24
      • 2016-08-11
      相关资源
      最近更新 更多