主配置文件:

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. flask uwsgi和nginx配置信息

    1. 安装 pip3 install uwsgi 2. uwsgi配置信息 创建一个uwsgi.ini文件 [uwsgi] socket=/opt/script/uwsgi.sock #启动程序时所使 ...

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

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

  3. [转]Nginx配置信息详解

    序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HTTP服务器,也 ...

  4. 自己站点的nginx 配置信息

    user www www; worker_processes auto; error_log /home/wwwlogs/nginx_error.log crit; pid /usr/local/ng ...

  5. nginx配置ssl证书实现https访问

    一,环境说明 服务器系统:ubuntu16.04LTS 服务器IP地址:47.89.12.99 域名:bjubi.com 二,域名解析到服务器 在阿里云控制台-产品与服务-云解析DNS-找到需要解析的 ...

  6. 阿里云 nginx配置ssl证书实现https访问

    一,环境说明 服务器系统:ubuntu16.04LTS 服务器IP地址:47.89.12.99 域名:bjubi.com 二,域名解析到服务器 在阿里云控制台-产品与服务-云解析DNS-找到需要解析的 ...

  7. nginx配置ssl证书实现https

    一,环境说明 服务器系统:centos6 服务器IP地址:0.0.0.0 域名:bjubi.com 二,域名解析到服务器 在阿里云控制台-产品与服务-云解析DNS-找到需要解析的域名点“解析”,进入解 ...

  8. [转帖]nginx配置ssl证书实现https访问

    https://www.cnblogs.com/tianhei/p/7726505.html 今天就是如此处理的 感觉挺不错的. 一,环境说明 服务器系统:ubuntu16.04LTS 服务器IP地址 ...

  9. nginx入门与实战 安装 启动 配置nginx Nginx状态信息(status)配置 正向代理 反向代理 nginx语法之location详解

    nginx入门与实战 网站服务 想必我们大多数人都是通过访问网站而开始接触互联网的吧.我们平时访问的网站服务 就是 Web 网络服务,一般是指允许用户通过浏览器访问到互联网中各种资源的服务. Web ...

随机推荐

  1. pycharm引入numpy报错:ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy.

    软件为pycharm,安装了anaconda. 我一开始的报错为,PyCharm中无法调用numpy,报错ModuleNotFoundError: No module named 'numpy',这个 ...

  2. (转)【Java线程】Java内存模型总结

    Java的并发采用的是共享内存模型(而非消息传递模型),线程之间共享程序的公共状态,线程之间通过写-读内存中的公共状态来隐式进行通信.多个线程之间是不能直接传递数据交互的,它们之间的交互只能通过共享变 ...

  3. 在web中实现当前变量和前一个的比较

    /*if (attribute == null) {// 如果缓存中没有存过UploadTimeObj对象,那么创建对象,并将该对象存入缓存中                    UploadTim ...

  4. 判断socket连接是否失效

    http://blog.csdn.net/jazywoo123/article/details/8693661 http://www.itnose.net/st/141698-pn11.html

  5. 工作笔记—新浪微博Oauth2.0授权 获取Access Token (java)

    java发送新浪微博,一下博客从注册到发布第一条微博很详细 利用java语言在eclipse下实现在新浪微博开发平台发微博:http://blog.csdn.net/michellehsiao/art ...

  6. html&css 易忽略的知识点

    1.input标签的readonly属性 <input type="text" readonly="readonly"/>

  7. 可以替代putty的ssh客户端

    1. Bitvise SSH Client http://www.putty.org/ Bitvise SSH Client is an SSH and SFTP client for Windows ...

  8. 安装NVIDIA驱动时禁用自带nouveau驱动

    安装英伟达驱动时,一般需要禁用自带nouveau驱动,按如下命令操作: sudo vim /etc/modprobe.d/blacklist-nouveau.conf 添加如下内容: blacklis ...

  9. svn与git操作对比 (未来有空做一个 svn与git实战对比 )

    svn是集中式的,git是分布式的,但是我们日常使用的都是按照集中式唯一服务器仓库的方式来去做的,最终我们的代码都要提交到一个唯一仓库中. 他们最大的区别是本地工作拷贝的工作方式不同, 一.svn本地 ...

  10. iOS开发-命令模式

    命令模式算是设计模式中比较简单的,最常见的例子是工作任务安排下来进行编程,如果工作任务不需要完成,我们可以取消我们之前完成的代码,也可以理解为回滚撤销操作.这里面涉及到命令模式中的两个对象,一个是动作 ...