一些配置
2025年5月1日大约 1 分钟约 391 字
基于ip配置
ifconfig ens33:0 192.168.184.31 netmask 255.255.255.0
vim /usr/local/nginx/conf/nginx.conf
......
http {
......
server {
listen 192.168.184.30:80; #设置监听地址
server_name www.lic.com;
charset utf-8;
access_log logs/www.lic.access.log;
location / {
root /var/www/html/kgc;
index index.html index.php;
}
error_page 500 502 503 504 /50x.html;
location = 50x.html{
root html;
}
}
server {
listen 192.168.184.31:80; #设置监听地址
server_name www.accp.com;
charset utf-8;
access_log logs/www.accp.access.log;
location / {
root /var/www/html/accp;
index index.html index.php;
}
error_page 500 502 503 504 /50x.html;
location = 50x.html{
root html;
}
}
}
systemctl restart nginx知识点:
配置 server_name, 解释是:CODE 没有为 websocket 连接提供正确的主机,如果在它前面有一个代理