Nginx 配置文件2018-11 Centos 7.4

栏目: 服务器 · Nginx · 发布时间: 7年前

内容简介:发表于 2018-11-11 19:18:30 by月小升简单配置Nginx SSl

发表于 2018-11-11 19:18:30 by月小升

简单配置

server {
        listen       81;
        server_name  java-er.com;
        root         /www/java-er.com;
 
        location / {
                index index.html index.htm index.php;
        }
 
        location ~ \.php$ {
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
 
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

Nginx SSl

ssl                on;
        ssl_certificate      /www/javaer.com/ssl/full_chain.pem;
        ssl_certificate_key   /www/javaer.com/ssl/private.key;
        ssl_session_timeout  5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

WordPress 的URLREWRITE

if (!-e $request_filename){
rewrite (.*) /index.php;
}

完整配置

server {
        listen       80;
	listen  443 ssl; #监听两个端口
        server_name  java-er.com;
        root         /www/javaer.com;
	 ssl_certificate      /www/javaer.com/ssl/full_chain.pem;
        ssl_certificate_key   /www/javaer.com/ssl/private.key;
 
        location / {
		index index.html index.htm index.php;
 
 
if (!-e $request_filename) {
    rewrite (.*) /blog/index.php;
}
 
       }
 
	location ~ \.php$ {
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		include /etc/nginx/fastcgi_params;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
	}
        error_page 404 /404.html;
            location = /40x.html {
        }
 
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

php-fpm 的理解

1. 客户端通过http协议访问网站域名

2. Nginx接受请求,并路由转到index.php

3. 加载fastcgi模块

4. Fastcgi监听127.0.0.1:9000地址

5. 然后访问到达127.0.0.1:9000

6. php-fpm 监听127.0.0.1:9000,也就接收到了请求

7. Fpm的master主进程,分配子进程去处理请求

8. 处理完成后,返回结果给 nginx

9. Nginx通过http协议响应给客户端

首发地址:–

无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

掘金大数据

掘金大数据

程新洲、朱常波、晁昆 / 机械工业出版社 / 2019-1 / 59.00元

在数据横向融合的时代,充分挖掘数据金矿及盘活数据资产,是企业发展和转型的关键所在。电信运营商以其数据特殊性,必将成为大数据领域的领航者、生力军。各行业的大数据从业者要如何从电信业的大数据中挖掘价值呢? 本书彻底揭开电信运营商数据的神秘面纱,系统介绍了大数据的发展历程,主要的数据挖掘方法,电信运营商在网络运行及业务运营方面的数据资源特征,基于用户、业务、网络、终端及内在联系的电信运营商大数据分......一起来看看 《掘金大数据》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

html转js在线工具
html转js在线工具

html转js在线工具