如何安装nginx?

how to install nginx?

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

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

我该如何解决这个问题?

我发现了错误,在 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.

一切正常

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

nano /etc/nginx/fastcgi.conf

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

include /etc/nginx/fastcgi_params;