Nginx--try_files 典型配置

参考配置


server {

listen 80;

server_name 10.10.76.231;

root html;

index index.html index.php;

#1  跳转指定文件

location /web {

try_files /1.html /2.html /3.html;

}

#2  跳转指定页面

location /home {

try_files /1.html /2.html @static;

}

location @static  {

rewrite ^/(.*)$   http://www.baidu.com;

}

}

时间: 2024-08-06 04:28:01

Nginx--try_files 典型配置的相关文章

nginx一些参数配置详解

nginx的配置:    正常运行的必备配置:       1.user username [groupname];           指定运行worker进程的用户和组       2.pid /path/to/pidfile_name nginx的pid文件 3.worker_rlimit_nofile #;            一个worker进程所能够打开的最大文件句柄数:       4.worker_rlimit_sigpending #;            设定每个用户能够

利用nginx泛域名解析配置二级域名和多域名

利用nginx泛域名解析配置二级域名和多域名 网站的目录结构为 html ├── bbs └── www html为nginx的安装目录下默认的存放源代码的路径. bbs为论坛程序源代码路径 www为主页程序源代码路径 把相应程序放入上面的路径通过 http://www.youdomain.com 访问的就是主页 http://bbs.yourdomain.com 访问的就是论坛 其它二级域名类推. server { listen 80; server_name ~^(?<subdomain>

CodeIgniter框架——nginx下的配置

odeigniter(CI)是一个轻量型的PHP优秀框架,但是它是在apache服务器下开发的,在nginx下需要特别的配置才可以使用. 对nginx的配置如下: 1 server { 2 listen 80 default_server; 3 listen [::]:80 default_server ipv6only=on; 4 5 root /home/mqx/openflow/openflow/openflow/web; 6 index index.html index.htm inde

nginx 静态网站配置

/************************************************************************************** * nginx 静态网站配置 * 说明: * 配置下面的配置中包括python.php.静态网站的配置,配置静态网站主要目的是为了以后 * 能够跑Markdown生成的静态网站. * * 2016-8-7 深圳 南山平山村 曾剑锋 **********************************************

【Nginx】转:Nginx try_files

原来的配置是这样的: location / { try_files $uri $uri/ /index.php; index index.html index.htm index.php; } location ~ \.php$ { ... } 修改成了 location / { try_files $uri $uri/ /index.php =404; index index.html index.htm index.php; } location ~ \.php$ { ... } 增加的这个

初探nginx架构以及配置

1.nginx特性以及功能 2.nginx的架构及工作过程 3.nginx作为web服务器的配置 一.nginx特性以及功能 Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,供俄国大型的入口网站及搜索引擎Rambler(俄文:Рамблер)使用.其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用ngin

nginx环境下配置nagios-关于nagios配置文件nginx.conf

接上文:nginx环境下配置nagios-关于nginx.conf 配置如下: 1 server 2 { 3         listen       80; 4         server_name  192.168.44.44; 5         index index.html index.htm index.php; 6         root  /usr/local/nagios/share; 7         auth_basic "Nagios Access"; 

nginx+php的配置

nginx+php的配置比较简单,核心就一句话---- 把请求的信息转发给9000端口的PHP进程, 让PHP进程处理 指定目录下的PHP文件. 如下例子: location ~ \.php$ { //根目录 root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcg

Last-Modified和ETag以及Apache和Nginx中的配置

1) 什么是”Last-Modified”? 在浏览器第一次请求某一个URL时,服务器端的返回状态会是200,内容是你请求的资源,同时有一个Last-Modified的属性标记此文件在服务期端最后被修改的时间,格式类似这样: Last-Modified: Fri, 12 May 2006 18:53:33 GMT 客户端第二次请求此URL时,根据 HTTP 协议的规定,浏览器会向服务器传送 If-Modified-Since 报头,询问该时间之后文件是否有被修改过: If-Modified-Si

nginx常用服务配置

一.nginx.conf的配置方式,创建新vhost user nginx; worker_processes 4; worker_cpu_affinity 00000001 00000010 00000100 00001000; worker_rlimit_nofile 204800; pid /var/run/nginx.pid; events { worker_connections 204800; use epoll; multi_accept off; } http { include