欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

nginx添加http_ssl_module并且配置域名指定端口的操作方法

 更新時間:2023年11月22日 09:52:34   作者:輝@_@  
這篇文章主要介紹了nginx添加http_ssl_module并且配置域名指定端口的操作方法,文末附帶linux下防火墻和開放端口,需要的朋友可以參考下

1.切換到源碼包:

cd /home/nginx-1.23.1

2.進(jìn)行編譯:

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

3.配置完成后,運(yùn)行命令:

make

make命令執(zhí)行后,不要進(jìn)行make install,否則會覆蓋安裝。

4.備份原有已安裝好的nginx:

cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

5.停止nginx狀態(tài):

/usr/local/nginx/sbin/nginx -s stop

6.將編譯好的nginx覆蓋掉原有的nginx:

cd /home/nginx-1.23.1/ cp ./objs/nginx /usr/local/nginx/sbin/

7.提示是否覆蓋,輸入yes即可。

8.然后啟動nginx:

/usr/local/nginx/sbin/nginx

9.進(jìn)入nginx/sbin目錄下,通過命令查看模塊是否已經(jīng)加入成功:

cd /usr/local/nginx/sbin/ ./nginx -V

10.有以下提示,證明已經(jīng)編譯成功:

nginx version: nginx/1.23.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

nginx配置域名

     server {
	    listen 443 ssl;
	    server_name xxx.cn;
	    ssl_certificate     cert/xxx.pem;
	    ssl_certificate_key cert/xxx.key;
	    ssl_session_timeout 5m;
	    ssl_protocols TLSv1.2 TLSv1.3;
	    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
	    ssl_prefer_server_ciphers on;
	    add_header Content-Security-Policy upgrade-insecure-requests;
	    client_max_body_size 200M;
	    server_tokens off;
	    autoindex on;
	    charset uft8;
        error_page 500 502 503 504 /50x.html;
        location / {
            root /mnt/dist;
            index index.html index.htm;
            error_page 405 =200 $request_uri;
            try_files $uri $uri/ /index.html;
        }
        location /api{
                proxy_pass http://127.0.0.1:8080;
                proxy_read_timeout  360;
                proxy_set_header   X-Forwarded-Proto $scheme;
                proxy_set_header   Host              $http_host;
                proxy_set_header   X-Real-IP         $remote_addr;
                client_max_body_size 500m;
        }
        location = /50x.html {
                root /usr/share/nginx/html;
        }
    }

附帶linux下防火墻和開放端口

#查看防火墻是否開啟(如果顯示running,則防火墻為開啟狀態(tài)):
firewall-cmd --state
#關(guān)閉防火墻:
systemctl stop firewalld.service
#開啟防火墻
systemctl start firewalld.service
1、開啟防火墻 
     systemctl start firewalld
 ?
 2、開放指定端口
       firewall-cmd --zone=public --add-port=443/tcp --permanent
  		命令含義:
 		--zone #作用域
 		--add-port=1935/tcp  #添加端口,格式為:端口/通訊協(xié)議
 		--permanent  #永久生效,沒有此參數(shù)重啟后失效
?
 3、重啟防火墻
       firewall-cmd --reload
# 查詢端口是否開放
firewall-cmd --query-port=8080/tcp
lsof -i:8080(如果沒有l(wèi)sof,可以使用  yum install lsof  下載)
# 開放80端口
firewall-cmd --permanent --add-port=80/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
#重啟防火墻(修改配置后要重啟防火墻)
firewall-cmd --reload

到此這篇關(guān)于nginx下添加http_ssl_module并且配置域名,指定端口的文章就介紹到這了,更多相關(guān)nginx添加http_ssl_module內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論