centos 6 nginx+php7环境配置

编程教程 > Linux (1761) 2024-11-26 14:48:12

centos 6 nginx+php7环境配置 做一记录,谨防采矿
 

$title(php.conf)
#
# The default server
#

server {
    listen       80 default_server;
    server_name  localhost 127.0.0.1;

    location / {
		root /var/www/html;
		index index.php index.html ;
	
		#以下三行,目的是将代理服务器收到的用户的信息传到真实服务器上
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		
		#cookie
		proxy_set_header Cookie $http_cookie;
     }

    location ~ .*\.php(\/.*)*$ {
        root   /var/www/html;

        #以下三行,目的是将代理服务器收到的用户的信息传到真实服务器上
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

	#cookie
	proxy_set_header Cookie $http_cookie;

        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;

	set $path_info "";
        set $real_script_name $fastcgi_script_name;
                if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                        set $real_script_name $1;
                        set $path_info $2;
                }
        fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;
        fastcgi_param PATH_INFO $path_info;

        include        fastcgi_params;
    }


    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }


}

 


评论
User Image
提示:请评论与当前内容相关的回复,广告、推广或无关内容将被删除。

相关文章
centos 6 nginx+php7环境配置 做一记录,谨防采矿 $title(php.conf) # # The default server # server { l...
解决PHP程序以root启动导致部分Apache创建的文件权限不足问题
nginx配置文件检查命令正确命令:nginx -t -c /etc/nginx/nginx.conf错误命令:nginx -t -c /etc/nginx/conf.d/example.con...
Nginx 安装Nginx 安装参考:Linux yum nginx安装和nginx入门配置方法-XQLEE'BlogAlpine Linux nginx安装配
Nginx 配置日志nginx默认的日志配置在nginx.conf配置文件。
Nginx 限流组件limit_req limit_req作用: 限制用户(同一个ip)在给定时间内HTTP请求的数量, 流量限制主要用作安全目的, 可以防止大量请求的...
Linux(centos) nginx安装和nginx入门配置方法1.切换至root用户$su - 2.执行在线安装命令#yum install nginx -y 如果上面提示以下内容[root...
alpineLinux安装nginx更新软件apkupdate安装nginxapkaddnginx查看nginx版本nginx-vnginx启停启动停止servicenginxstop重启ser...
nginx开启gzip压缩配置配置参考:server{listen443ssl;server_namet.example.com;#charsetkoi8-r;#access_log/var/l...
打开任务管理器发现一大堆nginx进程
需求将静态资源如css/js/图片缓存到不用每次都到后端服务去拿取,减少性能消耗。 配置nginx缓存配置缓存文件存放信息在nginx配置文件,httpd内部配
最近网站被恶意访问了,了解了一些基础防护手段,nginx屏蔽ua访问 编写文件agent_deany.conf #使用方法 #创建目录 /etc/nginx/conf.d/deny...
最近博客升级总是nginx原生的502页面,感觉有些不友好,特此研究了下502页面的配置nginx 502配置502页面核心配置 #502 page error_...
最终看起来像这样 nginx (host,ssl) -&gtl; harbor-nginx (non-ssl) -&gtl; harbor。说明首先服务上安装有 nginx,且
nginx常规使用时作为http协议的反向代理,这里要讲的是非http的Mysql端口代理,理论支持其他协议nginx.conf配置如下:user nginx; worker_process...