- 搜索nginx
yum search nginx
- 安装
yum install -y nginx
- 启动
systemctl start nginx.service
- 设置为开机启动
systemctl start nginx.service
- 配置,默认安装配置文件目录在/etc/nginx/
server {
listen 80;
server_name pom.local.com;
root html;
location = /{
index index.html;
}
location / {
root /data/project/pom/web/;
proxy_set_header Host $host;
}
access_log logs/pom/access.log main;
}
cd /usr/share/nginx/
mkdir logs
cd logs
mkdir pom
- 检查配置文件是否正确
/usr/sbin/nginx -t
- 重新启动
/usr/sbin/nginx -s reload
systemctl restart nginx.service
- 本机配置hosts 指向内网服务器
sudo vim /etc/hosts
192.168.0.2 pom.local.com
- 访问 pom.local.com