created at 2023/08/05 04:13:06
updated at 2023/08/05 04:55:17
shell
yum install nginx -y
which nginx
# /usr/sbin/nginx
# start
nginx
# mkdir
mkdir -p /data/www
# config
nano /etc/nginx/conf.d/default.conf
json
server {
listen 80 default_server;
# listen [::]:80 default_server;
server_name _;
root /data/www; #p静态字资源目录
# 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 {
}
}
shell
# restart
nginx -s reload
touch /data/www/index.html
html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>第一个静态文件</title>
</head>
<body>
Hello world!
</body>
</html>