NGINX做为WEB服务器,运行PHP开发的程序和页面:

server {
listen 80;
listen 443 ssl;

ssl_certificate /usr/local/nginx/conf/ssl/ccgplay.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/ccgplay.key;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name www.cc.com;

log_format main escape=json '{ "@timestamp": "$time_iso8601", '
'"remote_addr": "$remote_addr",'
'"request_time": "$request_time",'
'"upstream_response_time": "$upstream_response_time",'
'"status": $status,'
'"x_forwarded": "$http_x_forwarded_for",'
'"http_referer": "$http_referer",'
'"request": "$request",'
'"upstream_addr": "$upstream_addr",'
'"body_bytes_sent":$body_bytes_sent,'
'"request_body":$request_body,'
'"http_user_agent": "$http_user_agent" }';

access_log /weblogs/cc.com_nginx.log combined;
index index.php;
include /usr/local/nginx/conf/rewrite/thinkphp.conf;
root /web/cc.com;

error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location / {
include /web/cc.com/.htaccess;
index index.php;

#如果文件不存在则尝试TP解析
}
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
valid_referers none blocked *.ccgplay.com new.ccgplay.com;
if ($invalid_referer) {
return 403;
}
}
location ~ .+\.php($|/) {
root //web/ccgplay.com;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;

#设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
#后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;

#加载Nginx默认服务器环境变量配置
include fastcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
}

NGINX+PHP配置的更多相关文章

  1. 如何在Nginx下配置PHP程序环境

    1.nginx与PHP的关系 首先来看nginx与php的关系, FastCGI的关系(而不是像apache那样安装成nginx的模块) FastCGI的意思是, 快速的通用网关接口:CGI Comm ...

  2. 从零开始学 Java - CentOS 下 Nginx + Tomcat 配置负载均衡

    为什么现在有非常多的聪明人都在致力于互联网? 最近在读埃隆·马斯克传记,他说「我认为现在有非常多的聪明人都在致力于互联网」. 仔细一想,好像真的是这样的. 我问了自己一个问题:如果你不敲代码了,你能做 ...

  3. Nginx主配置参数详解,Nginx配置网站

    1.Niginx主配置文件参数详解 a.上面博客说了在Linux中安装nginx.博文地址为:http://www.cnblogs.com/hanyinglong/p/5102141.html b.当 ...

  4. nginx + tomcat配置负载均衡

    目标:Nginx做为HttpServer,连接多个tomcat应用实例,进行负载均衡. 注:本例程以一台机器为例子,即同一台机器上装一个nginx和2个Tomcat且安装了JDK1.7. 1.安装Ng ...

  5. spring4+websocket+nginx详细配置

    实现的版本jdk1.7.0_25, tomcat7.0.47.0, Tengine/2.1.1 (nginx/1.6.2), servlet3.0, spring4.2.2 使用maven导入版本3. ...

  6. Nginx Location配置总结

    Nginx Location配置总结 语法规则: location [=|~|~*|^~] /uri/ { - }= 开头表示精确匹配^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即 ...

  7. 理解nginx的配置

    Nginx配置文件主要分成四部分:main(全局设置).server(主机设置).upstream(上游服务器设置,主要为反向代理.负载均衡相关配置)和 location(URL匹配特定位置后的设置) ...

  8. nginx缓存配置的操作记录梳理

    web缓存位于内容源Web服务器和客户端之间,当用户访问一个URL时,Web缓存服务器会去后端Web源服务器取回要输出的内容,然后,当下一个请求到来时,如果访问的是相同的URL,Web缓存服务器直接输 ...

  9. 在nginx中配置如何防止直接用ip访问服务器web server及server_name特性讲解

    看了很多nginx的配置,好像都忽略了ip直接访问web的问题,不利于SEO优化,所以我们希望可以避免直接用IP访问网站,而是域名访问,具体怎么做呢,看下面. 官方文档中提供的方法: If you d ...

  10. Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持

    前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...

随机推荐

  1. python 生成18年写过的博客词云

    文章链接:https://mp.weixin.qq.com/s/NmJjTEADV6zKdT--2DXq9Q 回看18年,最有成就的就是有了自己的 博客网站,坚持记录,写文章,累计写了36篇了,从一开 ...

  2. 安卓开发:初识Android Studio

    配置:Android Studio3.2.0,gradle-4.6 ,windows10  一.Android Studio安装 在http://www.android-studio.org/完成下载 ...

  3. 网络浅析(<<网络是怎么连接的>> 总结)

    概要 基本概念 网线 集线器 交换机 路由器 路由器和交换机 路由器和集线器 接入网 IP DNS 以太网 协议栈 网络连接过程 通信过程(浏览器 -> 服务器) 客户端和服务端 服务端的套接字 ...

  4. memcached 学习

    memcached 是什么 特点 协议简单 基于 libevent 的事件处理 内置内存存储方式 memcached 不互相通信的分布式 启动 安装 依赖 libevent 安装命令 下载地址在这个网 ...

  5. DEDECMS 漏洞修复方案

    目录 DEDECMS支付模块注入漏洞 漏洞文件: /include/payment/alipay.php 漏洞描述: 对输入参数$_GET['out_trade_no']未进行严格过滤 修复方案: 对 ...

  6. Springboot添加filter方法

    在springboot添加filter有两种方式: (1).通过创建FilterRegistrationBean的方式(建议使用此种方式,统一管理,且通过注解的方式若不是本地调试,如果在filter中 ...

  7. python学习——读取染色体长度(五:从命令行输入染色体长度)

    # 传递命令行参数 # 导入sys模块 import sys print(sys.argv)   命令行操作 python argv.py 10 20 30 40 50 回车输出 ['argv.py' ...

  8. LinkedList与Queue

    https://blog.csdn.net/u013087513/article/details/52218725

  9. Springboot + Atomikos + Druid + Mysql 实现JTA分布式事务

    DataSource 配置 package com.cheng.dynamic.config; import java.util.Properties; import javax.sql.DataSo ...

  10. remote: Permission to user_name/Code.git denied to other_user_name. fatal: unable to access 'https://github.com/user_name/Code.git/': The requested URL returned error: 403

    Error msg: $ git push remote: Permission to xxx/Code.git denied to xxxxxx. fatal: unable to access ' ...