标签:
以下信息仅针对Redstone的Ngxin配置文件进行更新。
web服务器Nginx配置文件结构如下:
/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 /run/nginx.pid;
#自定义设置
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
events {
use epoll;
worker_connections 2056;
}
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;
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;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
----
/etc/nginx/conf.d/cloud_ota.conf(云观象台配置文件)
server {
listen 8010;
listen 8610;
server_name fota.redstone.net.cn;
set $path "/home/www/cloud_ota";
#加载默认配置
include /etc/nginx/default.d/*.conf;
}
----
/etc/nginx/conf.d/bigdata.conf(大数据配置文件)
server {
listen 8020;
listen 8620;
server_name bigdata.redstone.net.cn;
set $path "/home/www/bigdata";
#加载默认配置
include /etc/nginx/default.d/*.conf;
}
----
/etc/nginx/conf.d/konka.conf(康佳配置文件)
client_max_body_size 2000m;
server {
listen 80;
listen 8030;
server_name konka.ota.redstone.net.cn;
set $path "/home/www/rs_detection";
#加载默认配置
include /etc/nginx/default.d/*.conf;
}
----
/etc/nginx/default.d/default.conf
location / {
root $path;
index index.html index.htm index.php;
#client_max_body_size 30m;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
#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 html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#location ~ \.php$ {
location ~ .*\.(php|php5)/?.*$ {
root $path;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
client_max_body_size 1024m;
#定义变量 $path_info ,用于存放pathinfo信息
set $path_info "";
#定义变量 $real_script_name,用于存放真实地址
set $real_script_name $fastcgi_script_name;
#如果地址与引号内的正则表达式匹配
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
#将文件地址赋值给变量 $real_script_name
set $real_script_name $1;
#将文件地址后的参数赋值给变量 $path_info
set $path_info $2;
}
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache‘s document root
# concurs with nginx‘s one
#
#location ~ /\.ht {
# deny all;
#}
#禁止浏览器下载有此后缀名的文件
location ~* \.(ini|txt|log)$ {
deny all;
}
-------------------------------------------------------------------------
反向代理服务器Nginx配置文件结构如下:
/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 /run/nginx.pid;
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;
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;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
rewrite ^(.*) http://www.redstone.net.cn ;#permanent
}
}
----
/etc/nginx/conf.d/cloud_ota.conf(云观象台配置文件)
upstream servers_cloud_ota {
server 114.215.180.137:8010;
server 114.215.178.111:8010 backup;
}
upstream servers_cloud_ota_api {
server 114.215.180.137:8610;
server 114.215.178.111:8610 backup;
}
server {
listen 80;
server_name fota.redstone.net.cn;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_pass http://servers_cloud_ota;
}
}
server {
listen 6100;
server_name fota.redstone.net.cn;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_pass http://servers_cloud_ota_api;
}
}
----
/etc/nginx/conf.d/bigdata.conf(大数据配置文件)
upstream servers_bigdata {
server 114.215.180.137:8020;
server 114.215.178.111:8020 backup;
}
upstream servers_bigdata_api {
server 114.215.180.137:8620;
server 114.215.178.111:8620 backup;
}
server {
listen 80;
server_name bigdata.redstone.net.cn;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://servers_bigdata;
}
}
server {
listen 6100;
server_name bigdata.redstone.net.cn;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://servers_bigdata_api;
}
}
----
/etc/nginx/conf.d/konka.conf(康佳配置文件)
upstream servers_konka {
server 114.215.180.137:8030;
server 114.215.178.111:8030 backup;
}
server {
listen 80;
server_name konka.ota.redstone.net.cn;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://servers_konka;
}
}
Redstone 云观象台 服务器部署 - Nginx配置文件
标签:
原文地址:http://www.cnblogs.com/Mwsoft/p/5520739.html