如何安装nginx?

lea*_*hat 2 nginx

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

sudo nginx -t
Run Code Online (Sandbox Code Playgroud)

这是错误消息:

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

我该如何解决这个问题?

lea*_*hat 5

我发现了错误,在 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;
    }
}
Run Code Online (Sandbox Code Playgroud)

在那里

include fastcgi.conf;

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

include fastcgi_params;

那么在 ubuntu 14.04 上一切都可以正常工作。