nginx centos 7

find server ip

1
ip addr

default directory

1
/usr/share/nginx/html

global configuration

1
/etc/nginx/nginx.conf

ss install

默认有防火墙,需要关闭

virtual host

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
server {
listen 80;
listen [::]:80;

root /guoshuang/demo;

index index.html;

server_name demo.guoshuang.com;

access_log /var/log/nginx/demo.guoshuang.com.access.log;
error_log /var/log/nginx/demo.guoshuang.com.error.log;

location / {
try_files $uri $uri/ =404;
}
}