mkdir /usr/local/nginx
cd /usr/local/nginx
wget http://nginx.org/download/nginx-1.20.2.tar.gz
tar -zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
yum update
yum install openssl openssl-devel
yum -y install pcre-devel
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
环境变量
vi /etc/profile
PATH=$PATH:/usr/local/nginx/sbin
export PATH
source /etc/profile
修改 nginx.conf文件如果不改为user root 后面可能会报错无权限访问
vim /usr/local/nginx/conf/nginx.conf
user root;
worker_processes 8;
nginx 编译和安装ssl模块
开启webSocket支持
在http下配置
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
在localhost下配置
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";