1.编写nginx配置文件
1 2 3 4 5 6 7 8 9 |
[root@web02 ~]# vim /etc/nginx/conf.d/default.conf server { listen 80; server_name localhost; location / { root /code/mario; index index.html; } } |
2.创建目录
1 |
[root@web02 ~]# mkdir /code |
3.上传代码
1 2 |
[root@web02 ~]# cd /code [root@web02 /code]# rz mario.zip |
4.解压代码
1 2 3 |
[root@web02 /code]# unzip mario.zip #授权 [root@web02 /code]# chown -R www.www /code/ |
5.重启
1 2 3 4 5 |
[root@web02 /code]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@web02 /code]# systemctl restart nginx |