server {
listen 80;
server_name localhost; set $expires_duration "30d";
if ($uri ~* \.html$) {
set $expires_duration "10m";
} expires $expires_duration; location /public/ {
root /usr/share/nginx/html;
} location /tmp/ {
root /home/popeye;
} location = /m {
root /usr/share/nginx/html;
error_page 404 404.html;
} location /m/ {
root /usr/share/nginx/html;
error_page 404 404.html;
} location / {
root /usr/share/nginx/html/portal;
error_page 404 404.html;
} }
worker_processes  4;
worker_cpu_affinity 0001 0010 0100 1000;
worker_rlimit_nofile 65535;
events {
worker_connections 65535;
use epoll;
} http {
include mime.types;
default_type application/octet-stream;
log_format log_json '{ "@timestamp": "$time_local", "remote_addr": "$remote_addr", "referer": "$http_referer",'
'"request": "$request", "status": $status, "bytes": $body_bytes_sent, "agent": "$http_user_agent", '
'"x_forwarded": "$http_x_forwarded_for", "up_addr": "$upstream_addr",'
'"up_host": "$upstream_http_host", "up_resp_time": "$upstream_response_time", "request_time": "$request_time"}';
access_log logs/access.log log_json;
sendfile on;
tcp_nopush on;
tcp_nodelay on; keepalive_timeout 500; server_names_hash_bucket_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
client_header_timeout 3m;
client_max_body_size 300m;
client_body_buffer_size 512k;
send_timeout 60s; fastcgi_read_timeout 5000;
fastcgi_connect_timeout 5000;
fastcgi_send_timeout 5000; fastcgi_buffers 4 512k;
fastcgi_buffer_size 256k;
fastcgi_busy_buffers_size 512k;
fastcgi_temp_file_write_size 512k; proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_buffer_size 256k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m; gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
upstream portal-html {
server ip;
} server {
listen 80;
server_name servername;
location = /limited.html {
root /usr/share/nginx/html/portal;
}
location = /m/limited.html {
root /usr/share/nginx/html/;
} location ~* ^(|/|/[^/]+\.html)$ {
error_page 403 /limited.html;
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
rewrite ^(.*)$ https://$host/m$1 redirect;
break;
}
proxy_pass http://portal-html;
}
location /m {
error_page 403 /m/limited.html;
proxy_pass http://portal-html;
}
}
}

nginx配置备份的更多相关文章

  1. Nginx配置信息损毁又无备份时如何恢复

    worker_processes *; 本文介绍在Nginx配置信息出现问题后,在没有备份的情况下,如何利用Nginx进程的虚拟内存恢复配置信息. 问题背景 假设 /etc/nginx/site-av ...

  2. nginx配置入门

    谢谢作者的分享精神,原文地址:http://www.nginx.cn/591.html nginx配置入门 之前的nginx配置是对nginx配置文件的具体含义进行讲解,不过对于nginx的新手可能一 ...

  3. nginx配置学习文章

    partOne 自我释义部分 我的是阿里云的ubuntu *******实际上感觉这里是基本配置,很用不到*********#定义其用户或用户组user www-data;#nginx的进程数,应当为 ...

  4. Centos7.2下Nginx配置SSL支持https访问(站点是基于.Net Core2.0开发的WebApi)

    准备工作 1.基于nginx部署好的站点(本文站点是基于.Net Core2.0开发的WebApi,有兴趣的同学可以跳http://www.cnblogs.com/GreedyL/p/7422796. ...

  5. nginx 配置入门

    之前的nginx配置是对nginx配置文件的具体含义进行讲解,不过对于nginx的新手可能一头雾水. 今天看到个文档不错,翻译过来分享给大家,可以让新手更详细地了解nginx配置,可以说是nginx配 ...

  6. nginx服务器配置/websocket nginx 配置笔记

    server { listen 80; server_name xxx.com; # add_header '*' ; location /u/ { # 反向代理透传客户端ip proxy_set_h ...

  7. nginx配置SSL实现服务器/客户端双向认证

    http://blog.csdn.net/kunoy/article/details/8239653 本人不才,配置了两天,终于搞出来了,结合网上诸多博文,特此总结一下! 配置环境: Ubuntu 1 ...

  8. nginx配置https转发http

    生成ssl证书: 1.首先要生成服务器端的私钥,运行时会提示输入密码,此密码用于加密key文件: openssl genrsa -des3 -out server.key 1024 2.去除key文件 ...

  9. Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试

    标签:Linux 域名 Nginx 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xpleaf.blog.51cto.com/9 ...

随机推荐

  1. cocos大量对象使用动作注意事项

    ,,} for i,v in ipairs(area) do if gameResult == v then ]) do local scale_1 = cc.ScaleTo:create(0.05, ...

  2. windows mysql 和linux mysql解决乱码问题

    windows : 1找到mysql安装目录的my.ini文件 2修改的里面的内容为 character-set-server=utf8 default-character-set=UTF-8 然后打 ...

  3. 从n个数中随机选出k个数,并判断和是不是素数

    洛谷p1036 #include<iostream> #include<math.h> using namespace std; ],n,k;//依照题目所设 bool isp ...

  4. 使用VBA轻松实现汉字与拼音的转换

    Function pinyin(p As String) As String i = Asc(p) Select Case i Case -20319 To -20318: pinyin = &quo ...

  5. JS Math方法

  6. WebService中用CXF框架的wsdl部署生成客户端代码时,使用cmd命令口出现wsimport不是内部或外部命令的问题

    网上有很多,都不好用,这个立竿见影的 set JAVA_HOME = *:\Program Files\Java\jdk1.8.0_181(此处为自己jdk的安装路径) set CLASSPATH = ...

  7. Linux查看服务器配置

    服务器型号 [root@txs ~]# dmidecode|grep "System Information" -A9|egrep "Manufacturer|Produ ...

  8. 从零开始写自己的PHP框架系列教程(一)[core.php]

    这里我直接上代码: /** * 框架核心 */ if (version_compare(PHP_VERSION, '5.3.0','<')) { header("Content-Typ ...

  9. Python matplotlib.pyplot

    Customize the label, title, and ticks. Add Color to bubbles Add Text & Grid

  10. 震惊!!!源程序特征统计程序——基于python getopt库

    项目github地址:https://github.com/holidaysss/WC PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟 ...