linux nginx的配置總結

2021-09-09 06:51:15 字數 1918 閱讀 1165

用了nginx有段時間了,今天總結一下包括80埠的配置 443埠 ssl配置

首先看防火牆,本地直接就關了吧,如果是伺服器看看防火牆看的沒,看的話看看埠開了沒。參考

centos新增埠白名單

進到目錄      cd /usr/local/nginx/conf/ 

建立兩個檔案vhost(虛擬主機)和cert(證書)方便管理。

先把原來的備份了  mv nginx.conf nginx.conf.back

vhost裡面專門放配置檔案 進入vhost檔案

例如:vim 80.conf

server 

}location ~ .php$

#access_log logs/80.access.log main;

#error_log logs/80.error.log info;

}

443配置

}如果您的**的評分已經達到a,那麼沒有被評到a+的最大的可能性就是沒有使用hsts,使用hsts的方法很簡單,只要在新增strict-transport-security這個http頭部資訊即可

add_header strict-transport-security "max-age=31536000";
nginx

ssl_ciphers ecdhe-rsa-aes128-gcm-sha256:ecdhe:ecdh:aes:high:!null:!anull:!md5:!adh;

ssl_protocols sslv3 tlsv1 tlsv1.1 tlsv1.2;

nginx

ssl_ciphers eecdh+chacha20:eecdh+chacha20-draft:eecdh+aes128:rsa+aes128:eecdh+aes256:rsa+aes256:eecdh+3des:rsa+3des:!md5;

ssl_protocols tlsv1 tlsv1.1 tlsv1.2;

nginx

ssl_ciphers eecdh+chacha20:eecdh+chacha20-draft:eecdh+aes128:rsa+aes128:eecdh+aes256:rsa+aes256::!md5;

ssl_protocols tlsv1 tlsv1.1 tlsv1.2;

但也有可能因為openssl版本的不同會導致相同的配置得到不同的檢測結果。如果您的openssl處於較新的版本那麼按照最好的安全性進行配置,得到乙個a,應該是沒有問題的。

參考:location /

Linux Nginx 安裝配置

nginx安裝 關於nginx的安裝推薦 牛遷遷的教程,裡面包含了安裝過程和常見錯誤 nginx.conf檔案配置 nginx作為前置http伺服器 如果僅使用ip來訪問,那麼直接訪問埠號即可,nginx.conf檔案裡做如下配置 upstream web server 如果使用網域名稱來訪問,而網...

Linux Nginx配置負載均衡

安裝nginx upstream check module模組 patch p1 tmp nginx upstream check module master check 1.16.1 patch 配置nginx make make install 安裝sticky模組 make 拷貝編譯出來的二進...

linux nginx 安裝 與 配置

1,安裝 安裝sudo yum install y nginx 檢視安裝路徑 whereis nginx 如 nginx usr sbin nginx usr lib64 nginx etc nginx usr share nginx usr share man man8 nginx.8 gz新增啟...