nginx配置备份
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配置备份的更多相关文章
- Nginx配置信息损毁又无备份时如何恢复
worker_processes *; 本文介绍在Nginx配置信息出现问题后,在没有备份的情况下,如何利用Nginx进程的虚拟内存恢复配置信息. 问题背景 假设 /etc/nginx/site-av ...
- nginx配置入门
谢谢作者的分享精神,原文地址:http://www.nginx.cn/591.html nginx配置入门 之前的nginx配置是对nginx配置文件的具体含义进行讲解,不过对于nginx的新手可能一 ...
- nginx配置学习文章
partOne 自我释义部分 我的是阿里云的ubuntu *******实际上感觉这里是基本配置,很用不到*********#定义其用户或用户组user www-data;#nginx的进程数,应当为 ...
- Centos7.2下Nginx配置SSL支持https访问(站点是基于.Net Core2.0开发的WebApi)
准备工作 1.基于nginx部署好的站点(本文站点是基于.Net Core2.0开发的WebApi,有兴趣的同学可以跳http://www.cnblogs.com/GreedyL/p/7422796. ...
- nginx 配置入门
之前的nginx配置是对nginx配置文件的具体含义进行讲解,不过对于nginx的新手可能一头雾水. 今天看到个文档不错,翻译过来分享给大家,可以让新手更详细地了解nginx配置,可以说是nginx配 ...
- nginx服务器配置/websocket nginx 配置笔记
server { listen 80; server_name xxx.com; # add_header '*' ; location /u/ { # 反向代理透传客户端ip proxy_set_h ...
- nginx配置SSL实现服务器/客户端双向认证
http://blog.csdn.net/kunoy/article/details/8239653 本人不才,配置了两天,终于搞出来了,结合网上诸多博文,特此总结一下! 配置环境: Ubuntu 1 ...
- nginx配置https转发http
生成ssl证书: 1.首先要生成服务器端的私钥,运行时会提示输入密码,此密码用于加密key文件: openssl genrsa -des3 -out server.key 1024 2.去除key文件 ...
- Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试
标签:Linux 域名 Nginx 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xpleaf.blog.51cto.com/9 ...
随机推荐
- mybatis(2)--配置mybatis实现连接数据库查询
1.新建项目 2.在src下创建一个xml文件 比如这xml文件名为 mybatis.xml 一下为初始xml文件代码 <?xml version="1.0" encodin ...
- 最近学习的 Node.js 基础:安装、环境配置、forever
最近工作中,因为某某某某原因,需要用到Node.js . 发现在很多方面和python很像,比如generator / yield ,比如模块的使用方式,比如http模块. 先安装个环境,windo ...
- db.properties是干什么用的
连接池配置文件db.properties是java中采用数据库连接池技术完成应用对数据库的操作的配置文件信息的文件.具体配置项目如下:drivers=com.microsoft.sqlserver.j ...
- 学习小片段——thymeleaf入门
1: 概述 thymeleaf是一个跟 Velocity.FreeMarker 类似的模板引擎,和以前学的jsp相近,但性能上无疑是比jsp好. 参考文档官方文档:https://www.thymel ...
- 周强 201771010141 《面向对象程序设计(Java)》第十一周学习总结
实验十一 集合 实验时间 2018-11-8 1.实验目的与要求 (1) 掌握Vetor.Stack.Hashtable三个类的用途及常用API: Vector类实现了长度可变的数组. Stack ...
- L2-022 重排链表 (25 分)
L2-022 重排链表 (25 分) 给定一个单链表 L1→L2→⋯→Ln−1→Ln,请编写程序将链表重新排列为 Ln→L1→Ln−1→L2→⋯.例 ...
- centOS6.0虚拟机ip配置
1.首先使用虚拟机安装好centOS6.0系统 2.虚拟机网络配置:(选择桥接模式) 3. 第一步:首先关闭防火墙 1.将防火服务从启动列表移除 #chkconfig --del iptables # ...
- React native 中 SectionList用法
一.代码 import React, { Component } from 'react'; import { AppRegistry, View, Text, SectionList, } from ...
- 2017年java面试题【集合篇】
Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承.指针等概念,因此Java语言具有功能强大和简单易用两个特征. 这里有10个经典的Java面试题,也为大 ...
- js常用随手记
1. 判断是否是空对象 let myObject={} Object.keys(myObject).length 2. void 0 代替 undefined undefined 不是保留字,在局部作 ...