一、安装
yum install nginx
二、启动
service nginx start
三、修改配置文件
1、cd /etc/nginx
2、vim nginx.conf 删除以下内容保存退出
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
3、cd conf.d
4、vim test.conf新建配置文件保存退出,文件内容如下
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
四、重启
service nginx restart
备注:许多第一次安装Nginx的不知道要删除 nginx.conf的配置内容。