怎麼解決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) []: #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=,/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埠
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69948194/viewspace-2665839/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mac環境下配置nginx反向代理,https協議MacNginxHTTP協議
- nginx配置https協議訪問NginxHTTP協議
- 什麼是HTTPS協議?為什麼要用HTTPS協議?HTTP協議
- nginx配置支援websocket協議wssNginxWeb協議
- HTTPS協議詳解HTTP協議
- HTTP協議無狀態,該怎麼解決?HTTP協議
- centos nginx下配置免費httpsCentOSNginxHTTP
- CentOS7.6怎麼禁用IPv6協議CentOS協議
- nginx做正向代理(Centos7,支援http和https)NginxCentOSHTTP
- HTTPS 協議HTTP協議
- nginx+thinkphp下解決不支援pathinfo模式NginxPHP模式
- 配置https協議HTTP協議
- 理解 HTTPS 協議HTTP協議
- centos vim亂碼怎麼解決?CentOS
- https協議的理解HTTP協議
- Http與Https協議HTTP協議
- HTTP和HTTPS協議HTTP協議
- Flex使用Https協議FlexHTTP協議
- 怎麼讓後臺模組支援httpsHTTP
- HTTP協議和HTTPS協議的異同點?HTTP協議
- 在 CentOS 下為 nginx 啟用 SSL_sendfile 支援CentOSNginx
- 詳解HTTP&HTTPS協議及面試題HTTP協議面試題
- 深入理解HTTPS協議HTTP協議
- nginx使用ssl模組配置HTTPS支援NginxHTTP
- HTTPS協議詳解(四):TLS/SSL握手過程HTTP協議TLS
- 基於 CentOS 7 搭建支援 HTTP 協議的 SVN 伺服器CentOSHTTP協議伺服器
- HTTP HSTS協議和 nginxHTTP協議Nginx
- 實現網站由http協議轉為https協議網站HTTP協議
- 下載東西網速慢該瞭解的網路協議支援協議
- WebSphere配置https協議訪問WebHTTP協議
- 聊聊HTTPS和SSL/TLS協議HTTPTLS協議
- 怎麼解決網站被DDOS攻擊 利用7層協議進行防禦網站協議
- 誰知道這個錯誤怎麼解決 javax.transaction.xa.XAException: 違反協議JavaException協議
- 輕鬆讓你的nginx伺服器支援HTTP2協議Nginx伺服器HTTP協議
- 【BGP乾貨】怎麼理解BGP協議?協議
- centos下安裝nginxCentOSNginx
- HTTPS 協議降級攻擊原理HTTP協議
- nginx配置https(可支援thinkphp的pathinfo模式)NginxHTTPPHP模式