centos下的nginx安装和配置(Nginx installation and configuration under CentOS)

配置

1.资源路径

2.默认首页地址 http://ip 访问index.html

资源都要放在/data/www 下

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /data/www;
	
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

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

        error_page 404 /404.html;
            location = /40x.html {
        }

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

to configure

1. Resource path

2.默认首页地址 http://ip 访问index.html

All resources should be placed under / data / www

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /data/www;
	
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

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

        error_page 404 /404.html;
            location = /40x.html {
        }

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