主配置文件:

cat /etc/nginx/nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
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 /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

client_header_buffer_size 16k;
large_client_header_buffers 4 64k;
client_max_body_size 5M;

proxy_headers_hash_max_size 2048;
proxy_headers_hash_bucket_size 256;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
}

各服务配置文件:

服务一:

cat api.xxx.com.conf
server {
listen 90;
server_name api.xxx.com;

#location / {
# root /usr/share/nginx/html;
# index index.html index.htm;
#}

location / {
root /data/www_xxx/h5html;
index index.html index.htm;
proxy_pass http://127.0.0.1:28080;

# Forward the user's IP address to Rails
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

}

服务二:

cat  m.api.xxx.com.conf
server {
listen 80;
server_name  m.api.xxx.com;

#location / {
# root /usr/share/nginx/html;
# index index.html index.htm;
#}

location / {
root /data/www/h5html;
index index.html index.htm;

# Forward the user's IP address to Rails
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;

if ( !-e $request_filename ) {
proxy_pass http://127.0.0.1:28080;
}
}

location ~ .*\.(html|htm) {
root /data/fulu/www_fulucz/h5html;
#expires 30d; #缓存30天
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

}

server {
listen 90;
server_name m.api.xxx.com;

return 301 https://m.api.xxx.com$request_uri;
}

nginx 配置信息相关推荐

  1. nginx html解析插件,nginx配置信息的解析流程

    nginx配置信息的解析流程 2011年9月9日 1,744 次浏览 请关注最新修正合订: 这一系列的文章还是在09年写的,存在电脑里很久了,现在贴出来.顺序也不记得了,看到那个就发那个吧,最近都会发 ...

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

    Nginx配置信息损毁又无备份时如何恢复 worker_processes *; 本文介绍在Nginx配置信息出现问题后,在没有备份的情况下,如何利用Nginx进程的虚拟内存恢复配置信息. 问题背景 ...

  3. nginx 配置静态文件目录_nginx缓存静态资源,只需几个配置提升10倍页面加载速度...

    nginx缓存静态资源,只需几个配置提升10倍页面加载速度 首先我们看图说话 这是在没有缓存的情况下,这个页面发送了很多静态资源的请求: 可以看到,静态资源占用了整个页面加载用时的90%以上,而且这个 ...

  4. Linux下nginx配置证书实现https访问

    Linux下nginx配置证书实现https访问 一.下载并安装nginx (1)执行下列命令安装Nginx.yum install -y nginx 参考自https://www.cnblogs.c ...

  5. Nginx配置使用积累[不断更新]

    由于网上Nginx的文档太少,很多特性只能自己去尝试,遂记录Nginx的一些使用知识. 以下nginx.conf配置文件中的配置: 1.Nginx不记录错误日志: error_log /dev/nul ...

  6. Nginx 配置中一个不起眼字符 “/“ 的巨大作用

    Nginx作为一个轻量级的,高性能的web服务软件,因其占有内存少,并发能力强的特点,而广受欢迎和使用.国内很多大型互联网公司也对Nginx很是青睐.像BAT(百度,阿里和腾讯),TMD(头条,美团和 ...

  7. Nginx配置跨域请求 Access-Control-Allow-Origin *

    Nginx配置跨域请求 Access-Control-Allow-Origin * 当出现403跨域错误的时候 No 'Access-Control-Allow-Origin' header is p ...

  8. Linux查看nginx相关信息

    1.查看nginx的目录 命令:ps -ef |grep nginx 截图: 2.查看nginx的配置文件信息 命令:cat /usr/local/nginx/conf/nginx.conf 截图: ...

  9. nginx配置参数详解

    PS:Nginx使用有两三年了,现在经常碰到有新用户问一些很基本的问题,我也没时间一一回答,今天下午花了点时间,结合自己的使用经验,把Nginx的主要配置参数说明分享一下,也参考了一些网络的内容,这篇 ...

最新文章

  1. Fiddler抓包使用教程-过滤
  2. 文件服务器 之 ProFTPD+MySQL 认证
  3. PHP webservie连接.net接口
  4. 第十章:禁丹药,禁符纸
  5. 学web前端有什么计划?
  6. init是一个自定义方法名
  7. 几何公差(GDT)的特征项目及符号
  8. papervision3d 开发经典例子
  9. 利用Fiddler实现在pc微信端测试
  10. Wireshark分析流量包案例
  11. Unity shader 实现圆角矩形
  12. 社保缴费满15年就可以不缴了?6个很多人最关心的问题权威解答来了
  13. SpringSecurity-12-PasswordEncoder密码加密简介
  14. python提取cad中的文字_[python]提取PPT中的文字(包括图片中的文字)
  15. 【Windows】服务程序
  16. 安装photoshop cc 2015几个问题的解决
  17. d强制访问位置服务器的数据库w,基于WEB的分布式数据库系统的研究与设计-软件工程专业论文.docx...
  18. 新版标准日本语中级_第三十一课
  19. 手动安装 Acrobat 9.X 的 PDF 打印机方法
  20. Unity分格式血条

热门文章

  1. Exchange企业实战技巧(16)发布SMTP、POP、IMAP连接信息设置
  2. 一道算法题,求更好的解法
  3. 摩卡签约印尼五大运营商之一CSM,进军东南亚市场
  4. TMSScripter演示
  5. CentOS7.3下Jenkins+docker自动化部署solo站点
  6. 机器学习:Python中如何使用最小二乘法
  7. 与《管理幸福》一书作者Jurgen Appelo的访谈
  8. Android adb常用命令
  9. postgresql 可调试
  10. 在CentOS上部署基于dnx/coreclr的ASP.NET 5应用程序