阿里云Centos7.2 安装Wrodpress5.2 之 Nginx Https 配置

ithinkcry.cn有好多子域名:

https://ithinkcry.cn

https://blog.ithinkcry.cn

https://idea.ithinkcry.cn

https://quasar.ithinkcry.cn

http://nacos.ithinkcry.cn

由于wordpress比较好看,我决定替代原来自己写的springboot的demo博客作为主页,现在wordpress成了主站。

下面给出使用了https的wordpress的nginx的配置,并没有设置wordpress的配置文件,单纯的修改nginx。

 

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
	server {
			listen 80;
			server_name ithinkcry.cn;
			rewrite ^/(.*) https://$server_name$request_uri? permanent;
	}

    server {
        listen       443;
        server_name  ithinkcry.cn;
        ssl     on;
        server_name_in_redirect off;
        ssl_certificate   /home/deploy/certs/nginx/ithinkcry.cn.pem;
        ssl_certificate_key  /home/deploy/certs/nginx/ithinkcry.cn.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
		#很重要
        root /usr/local/wordpress;
        location = /favicon.ico {
          log_not_found off;
           access_log off;
        }
		#很重要
        location ~ \.php(.*)$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                #root /usr/local/wordpress;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
		#很重要
        location / {
                index index.php;
        }
        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }
        error_page  404              /404.html;
        error_page   500 502 503 504  /50x.html;
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }

    }
}

如果在配置过程中出现了,打开首页是下载文件,的现象,那么肯定是nginx的配置出错了,一般就是出错在这三个地方,这么配置,绝对不会错

        #很重要
        root /usr/local/wordpress;
        #很重要
        location ~ \.php(.*)$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                #root /usr/local/wordpress;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
        #很重要
        location / {
                index index.php;
        }

 

你可能感兴趣的:(wordpress)