在win nginx下配置symfony3.4,并隐藏项目名称 .php入口
在win nginx下配置symfony3.4,并隐藏项目名称 .php入口 记录下
# power by www.php.cn
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
#gzip on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
gzip_disable "MSIE [1-6].";
server_names_hash_bucket_size 128;
client_max_body_size 100m;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
server {
server_name yourdomain.com;
root "E:/phpStudy/PHPTutorial/WWW/yourProjectPath/web";
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# DEV
# This rule should only be placed on your development environment
# In production, don't include this and don't deploy app_dev.php or config.php
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
error_log "E:\phpStudy\PHPTutorial\WWW\yourProjectName\var\logs\project_error.log";
access_log "E:\phpStudy\PHPTutorial\WWW\yourProjectName\var\logs\project_access.log";
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
include vhosts.conf;
}
附:
1、nginx配置详解
基本配置与参数: http://www.nginx.cn/76.html
localtion: http://outofmemory.cn/code-snippet/742/nginx-location-configuration-xiangxi-explain
2、Apache配置详解
文章:https://www.cnblogs.com/pengyunjing/p/6654182.html
Apache官网文档:https://httpd.apache.org/docs/2.4/sections.html
------
------------------------
在win nginx下配置symfony3.4,并隐藏项目名称 .php入口的更多相关文章
- 如何在Nginx下配置PHP程序环境
1.nginx与PHP的关系 首先来看nginx与php的关系, FastCGI的关系(而不是像apache那样安装成nginx的模块) FastCGI的意思是, 快速的通用网关接口:CGI Comm ...
- NGINX下配置404错误页面的方法分享
NGINX下配置自定义的404页面是可行的,而且很简单,只需如下几步,需要的朋友可以参考下 1. 创建自己的404.html页面 2.更改nginx.conf在http定义区域加入: fastcg ...
- Ubuntu Nginx下配置网站ssl实现https访问
最近在看 HTTP权威指南 看到介绍了HTTPS的ssl,自己就动手测试了下,将步骤记录下 HTTPS简介 什么是HTTPS?百科是这样解释的.HTTPS(全称:Hyper Text Trans ...
- codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法
codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法 进入nginx的配置文件 加上一句(本来就有这句,只需要修改一下就行了) locatio ...
- tpadmin的坑收集 nginx下配置tp5失败
如下: 1.ADMIN模块如要关联查询,model的函数名一定不要有“_”下划线,否则找不到 /common/model/**.php 如果把函数名file写成“**_file”,调用时,$vo.** ...
- nginx下配置多个web服务
参考 nginx配置详解 nginx反向代理与负载均衡详解 一.nginx简介: Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能 ...
- macOS Sierra Version 10.12.6 环境下Tomcat的下载与安装以及InterlliJ IDEA 2017.2 环境下配置Tomcat 与创建Web项目
一.Tomcat的下载与安装 1.官网(http://tomcat.apache.org/)下载Tomcat 9.0 Core:zip包: 2.解压到指定的文件夹即可安装完成: 3.测试是否安装成功 ...
- Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持
前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...
- nginx下配置二级域名指向子目录
今天终于把nginx的二级域名配置搞定了,哎之前在测试服务器上弄过一次,不过那个是在本地解析的hosts,把ip指向到域名上就ok,再在nginx.conf里改了下配置就好了,用同样的方法改了正式服务 ...
- Nginx下配置虚拟主机的三种方法
Nginx下,一个server标签就是一个虚拟主机. 1.基于域名的虚拟主机,通过域名来区分虚拟主机——应用:外部网站 2.基于端口的虚拟主机,通过端口来区分虚拟主机——应用:公司内部网站,外部网站的 ...
随机推荐
- react 爷爷组件件传递给孙子组件
爷爷组件 import React, { Component } from "react"; import "./App.css"; import TestHa ...
- HBase多租户分组
一.分组简介 RegionServer Group 通过对 RegionServer 进行分组,不同的 RegionServer 分到不同的组.每个组可以按需挂载不同的表,并且当组内的表发生异常后,R ...
- 探秘Transformer系列之(3)---数据处理
探秘Transformer系列之(3)---数据处理 接下来三篇偏重于工程,内容略少,大家可以当作甜点 _. 0x00 概要 有研究人员认为,大模型的认知框架看起来十分接近卡尔·弗里斯顿(Karl F ...
- [HDU5603] the soldier of love 题解
考虑到正向求解困难,于是正难则反. 那么实际上对于 \(a_i\) 和 \(a_{i+1}\) 来说,它们给答案的贡献就是满足 \(l_j>a_i,r_j<a_{i+1}\) 的区间数量. ...
- Ansible - [01] 入门&安装部署
自动化运维工具,可以批量远程其他主机并进行管理操作 一.什么是 Ansible Ansible首次发布于2012年,作者:Michael DeHaan,同时也是Cobbler的作者,Ansible于2 ...
- php连接sql server 2014踩坑及处理记录
1.PDOException: SQLSTATE[42S02]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]对象名 'dbotest' ...
- 如果服务器是 PHP,并且 GET 请求可以接收到数据,但 POST 请求接收不到数据,可能是以下原因之一
如果服务器是 PHP,并且 GET 请求可以接收到数据,但 POST 请求接收不到数据,可能是以下原因之一: PHP 未正确解析 POST 请求体:PHP 需要通过 $_POST 或 php://in ...
- windows mysql8安装zip
MySQL 是一种广泛使用的关系数据库管理系统,MySQL 8 是其最新的主要版本,结合了出色的性能和丰富的功能. 一.准备工作 1. 下载MySQL 8 zip包 首先,你需要获取MySQL 8的压 ...
- HTTP Runner 运行提示执行后提示找不到有效的测试用例怎么解决?
确保yaml文件编写正确 2.yaml文件名称test_xxx.yaml test开头 3.更改httprunner 版本号 pip install httprunner==1.4.2
- iterm2配置ssh自动登录
iterm2 ssh 演示 cmd + o 打开服务器列表,方向键选择要登录的机器,回车,提示输入密码: option + cmd + f 打开密码管理器,方向键选择密码,回车,即可登录:(这一步通过 ...