搭建lnmp环境,nginx的配置文件/etc/nginx/nginx.conf

Posted 人可永真

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建lnmp环境,nginx的配置文件/etc/nginx/nginx.conf相关的知识,希望对你有一定的参考价值。

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
    worker_connections 1024;
}

http {
    include mime.types;
    default_type application/octet-stream;

    sendfile on;

    keepalive_timeout 65;

    server {
        listen 80;
        server_name localhost;

        location / {
            root html;
            index index.html index.htm;
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
            root html;
        }

        location ~ .php$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;   
            include        fastcgi_params;
        }
    }
}

  

以上是关于搭建lnmp环境,nginx的配置文件/etc/nginx/nginx.conf的主要内容,如果未能解决你的问题,请参考以下文章

LNMP环境搭建以及配置

搭建lnmp环境,nginx的配置文件/etc/nginx/nginx.conf

Ubuntu系统下lnmp环境搭建和Nginx多站点配置

LNMP环境搭建

LNMP环境搭建教程及linux常用命令及问题

用Dockerfile搭建LNMP环境