久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Centos下nginx配置https證書的操作步驟

140次閱讀
沒有評論

共計 3159 個字符,預計需要花費 8 分鐘才能閱讀完成。

這篇文章主要講解了“Centos 下 nginx 配置 https 證書的操作步驟”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著丸趣 TV 小編的思路慢慢深入,一起來研究和學習“Centos 下 nginx 配置 https 證書的操作步驟”吧!

1、首先配置 nginx 及其他插件,這個 Google 下,很多配置方案。

2、配置服務器的證書。操作步驟如下:

[root@localhost ~]# cd /etc/pki/tls/certs 

[root@localhost certs]# make server.key 

umask 77 ;

/usr/bin/openssl genrsa -aes128 2048 server.key

Generating RSA private key, 2048 bit long modulus

………………………………………………++++++

………….++++++

e is 61251 (0x10001)

Enter pass phrase:# set passphrase

Verifying – Enter pass phrase:# confirm

# remove passphrase from private key

[root@localhost certs]# openssl rsa -in server.key -out server.key 

Enter pass phrase for server.key:# input passphrase

writing RSA key

[root@localhost certs]#

[root@localhost certs]# make server.csr 

umask 77 ;

/usr/bin/openssl req -utf8 -new -key server.key -out server.csr

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter . , the field will be left blank.

—–

Country Name (2 letter code) [XX]:CN #country

State or Province Name (full name) [e]:Beijing   #state

Locality Name (eg, city) [Default City]:Beijing  #city

Organization Name (eg, company) [Default Company Ltd]:Test   #company

Organizational Unit Name (eg, section) []:Test Haha   #department

Common Name (eg, your server s hostname) []:www.test.com   #server s FQDN

Email Address []:admin@test.com # email address

Please enter the following extra attributes

to be sent with your certificate request

A challenge password []:# Enter

An optional company name []:# Enter

[root@localhost certs]#

[root@localhost certs]# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650

Signature ok

subject=/C=CN/ST=Beijing/L=Beijing/O=Test/OU=Test Haha/CN=www.test.com,/emailAddress=admin@test.com 

Getting Private key

[root@localhost certs]# chmod 400 server.*

3、配置 nginx 的 conf 文件

#server {

#       listen 80;

#       server_name happy.cc.com;

#       rewrite ^(.*)$  permanent;

#      }

server {

       listen 80;

       listen 443 ssl;

       server_name happy.cc.com;

       location / {

       root   /data/www/cloud;

       index  index.html;                                                                                                                                                                                                                  

       }

       ssl on;

       ssl_certificate /data/webserver/nginx/conf/server.crt;

       ssl_certificate_key /data/webserver/nginx/conf/server.key;

       ssl_session_timeout 5m;

       ssl_protocols  SSLv3 TLSv1;

       ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

       ssl_prefer_server_ciphers   on;

       #autoindex on;

       location = /favicon.ico {

       log_not_found off;

       access_log off;

       }

       location ~ .php$ {

       root           /data/www/cloud;

       fastcgi_pass   unix:/tmp/php-cgi.sock;

       #fastcgi_pass   127.0.0.1:9000;

       fastcgi_index  index.php;

       fastcgi_param  SCRIPT_FILENAME  /data/www/cloud$fastcgi_script_name;

       include        fastcgi_params;

       }

       location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$

       {

       expires 30d;

       }

       location ~ .*.(js|css)?$

       {

       expires 1h;

       }

      access_log /data/log/nginx/happy.access.log access;

      error_log /data/log/nginx/happy.error.log warn;

     }

4、打開 iptables 的 443 端口

感謝各位的閱讀,以上就是“Centos 下 nginx 配置 https 證書的操作步驟”的內容了,經過本文的學習后,相信大家對 Centos 下 nginx 配置 https 證書的操作步驟這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是丸趣 TV,丸趣 TV 小編將為大家推送更多相關知識點的文章,歡迎關注!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-28發表,共計3159字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 南华县| 长葛市| 新昌县| 文山县| 西平县| 如东县| 姚安县| 顺平县| 周至县| 称多县| 隆化县| 吴旗县| 祁连县| 永寿县| 皮山县| 托克逊县| 渭南市| 阿图什市| 嘉鱼县| 肥东县| 忻州市| 江津市| 泗洪县| 达日县| 丰县| 水富县| 石楼县| 醴陵市| 白沙| 磐石市| 沾益县| 汉沽区| 连城县| 新龙县| 成武县| 鹤峰县| 永清县| 汉沽区| 聂拉木县| 西昌市| 苍山县|