如何安装nginx?

时间:2015-04-06 09:16:20

标签: nginx

我正在尝试在我的系统中安装dotplant2,为此我需要安装nginx,然后我按照dotplant2文档提供的步骤进行操作,当我尝试重新启动时nginx 1}}作为文档解释的方式,它无法重启,当我输入此命令时

sudo nginx -t

以下是错误消息:

nginx:[emerg] open() "/etc/nginx/fastcgi.conf" failed (2: No such file or directory)   
in /etc/nginx/sites-enabled/dotplant2-host:20

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:4)

我发现错误,在dotpalant2文档中它说改变

/etc/nginx/sites-enabled/dotplant2-host

如下

server {
    listen 80;

    # NOTE: Replace with your path here
    root /home/user/dotplant2/application/web;
    index index.php;

    # NOTE: Replace with your hostname
    server_name dotplant2.dev;

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

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
    }

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

在那里

include fastcgi.conf;

但是在我们的nginx文件夹中没有fastcgi.conf所以我们必须更改为

include fastcgi_params;

然后所有这些都适用于ubuntu 14.04。

答案 1 :(得分:0)

最简单的解决方法是在/ etc / nginx /目录中创建丢失的文件...

nano /etc/nginx/fastcgi.conf

...并在其中写下这一行:

include /etc/nginx/fastcgi_params;