# 安装
dnf install nginx -y
# 开机启动
systemctl enable nginx
systemctl start nginx
vi /etc/nginx/nginx.conf
user root
keepalive_timeout 30;
# Gzip压缩
gzip on;
gzip_buffers 4 8k;
gzip_min_length 1k;
gzip_types application/javascript text/css application/octet-stream application/pdf image/gif image/jpeg image/png image/x-icon;
gzip_vary on;
#include /etc/nginx/conf.d/*.conf;
include /home/vhosts/*.conf;
# 创建目录
mkdir -p /home/vhosts
# 编辑配置文件
vi /home/vhosts/default.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /home/www/;
index index.html;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# 创建文件
mkdir -p /home/www
echo '<h1>WebMIS</h1>' > /home/www/index.html
chmod -R 777 /home/www/index.html
# 重启Nginx
systemctl restart nginx
业务咨询
技术问题