1.命令

#启动
systemctl start nginx.service
#关闭
systemctl stop nginx.service
#重启
systemctl restart nginx.service
#开机启动
systemctl enable nginx.service

2.配置

http {
    ...
    server {
        listen       80;
        server_name  localhost;
	add_header   Access-Control-Allow-Origin   '*'; 
 
        location / {
            root   html;
            index  index.html index.htm;
        }
 
	location /ts {
            alias   E:\\tspj;
            index  index.html index.htm;
        }
 
        ...
    }
    ...
 
 
 
}