当前位置: 首页 > news >正文

ubuntu LNMP nginx 隐藏index.php 配置文件

为什么80%的码农都做不了架构师?>>>   hot3.png

创建/编辑配置文件

#(自己设置虚拟主机的配置文件)
vi /etc/nginx/site-available/www.myredis.local.com
server {
	listen 80;
	
	root /var/www/html/tp3;

	index index.html index.htm index.php;

	server_name www.myredis.local.com;

	location / {
		
		index index.html index.php;	
		try_files $uri $uri/ =404;

		if (!-e $request_filename) {
			rewrite ^(.*)$ /index.php?s=$1 last;
			#rewrite ^/(.*)$ /index.php?s=$1 last;
			break;
		}
		autoindex on;
	}

	
	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	#
	location ~ \.php$ {

		fastcgi_pass unix:/run/php/php7.0-fpm.sock;
		fastcgi_index index.php;
		#fastcgi_split_path_info ^(.+\.php)(.*)$;
		fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
		include fastcgi_params;
	}

}

保存退出。

ln -s /etc/nginx/site-available/www.myredis.local.com /etc/nginx/site-enabled/

重启nginx

service nginx restart

 

转载于:https://my.oschina.net/marhal/blog/1924635

相关文章:

  • saltstack离线安装内部yum源搭建
  • mysql初次安装,设置密码
  • 将回调地狱按在地上摩擦的Promise
  • 如何恢复回收站删除的文件
  • 这是我的第一篇博客
  • 直播这么火,你知道怎么测试直播软件吗?
  • httpd
  • 游北国风光,忆南国之乡
  • IDEA 2018创建ssm工程 运行时出现500错误
  • 微软把UWP定位成业务线应用程序开发平台
  • CentOS 7使用dnf安装Memcached以及启动、停止、开机启动等设置
  • EventListener原理
  • 数据库设计,表与表的关系,一对一。One-To-One(1)
  • 对Emlog 6.0 Beta的完整代码审计过程
  • 学习微服务的路由网关zuul——路由转发和过滤器
  • Angular4 模板式表单用法以及验证
  • CAP理论的例子讲解
  • chrome扩展demo1-小时钟
  • es6--symbol
  • hadoop集群管理系统搭建规划说明
  • If…else
  • JS数组方法汇总
  • JS专题之继承
  • leetcode-27. Remove Element
  • Logstash 参考指南(目录)
  • magento 货币换算
  • mysql 5.6 原生Online DDL解析
  • nodejs调试方法
  • React-redux的原理以及使用
  • SOFAMosn配置模型
  • Wamp集成环境 添加PHP的新版本
  • 关于 Linux 进程的 UID、EUID、GID 和 EGID
  • 规范化安全开发 KOA 手脚架
  • 简单数学运算程序(不定期更新)
  • 精彩代码 vue.js
  • 如何利用MongoDB打造TOP榜小程序
  • Unity3D - 异步加载游戏场景与异步加载游戏资源进度条 ...
  • 通过调用文摘列表API获取文摘
  • ​LeetCode解法汇总2182. 构造限制重复的字符串
  • ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTr
  • #define
  • #define 用法
  • #Ubuntu(修改root信息)
  • $HTTP_POST_VARS['']和$_POST['']的区别
  • (2)(2.10) LTM telemetry
  • (33)STM32——485实验笔记
  • (4)Elastix图像配准:3D图像
  • (cljs/run-at (JSVM. :browser) 搭建刚好可用的开发环境!)
  • (day 2)JavaScript学习笔记(基础之变量、常量和注释)
  • (pojstep1.3.1)1017(构造法模拟)
  • (二十四)Flask之flask-session组件
  • (利用IDEA+Maven)定制属于自己的jar包
  • (转)socket Aio demo
  • . ./ bash dash source 这五种执行shell脚本方式 区别
  • ./和../以及/和~之间的区别