|
|
#指定nginx运行的用户及用户组,默认为nobody
|
|
|
#user nobody;
|
|
|
#开启的线程数,一般跟逻辑CPU核数一致
|
|
|
#worker_processes 1;
|
|
|
|
|
|
#error_log logs/error.log;
|
|
|
#error_log logs/error.log notice;
|
|
|
#error_log logs/error.log info;
|
|
|
#指定进程id的存储文件位置
|
|
|
#pid logs/nginx.pid;
|
|
|
|
|
|
|
|
|
#events {
|
|
|
#定义每个进程的最大连接数,受系统进程的最大打开文件数量限制。
|
|
|
#worker_connections 1024;
|
|
|
#}
|
|
|
|
|
|
#######Nginx的Http服务器配置,Gzip配置
|
|
|
#http {
|
|
|
#include mime.types;
|
|
|
#include /etc/nginx/mime.types;
|
|
|
include /etc/nginx/conf.d/mime.types;
|
|
|
#default_type application/octet-stream;
|
|
|
|
|
|
#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 logs/access.log main;
|
|
|
|
|
|
#sendfile on;
|
|
|
#tcp_nopush on;
|
|
|
|
|
|
#keepalive_timeout 0;
|
|
|
#keepalive_timeout 65;
|
|
|
|
|
|
#设置允许客户端请求的最大的单个文件字节数
|
|
|
#client_max_body_size 100M;
|
|
|
|
|
|
# upstream cosmoHlht_server {
|
|
|
# server 10.138.42.106:16010;
|
|
|
# server 10.138.42.109:16010;
|
|
|
# #server localhost:8011;
|
|
|
# #server localhost:8012;
|
|
|
# #ip_hash;#始终负载某一台机器
|
|
|
# }
|
|
|
server {
|
|
|
listen 80;
|
|
|
server_name localhost;
|
|
|
default_type 'text/html';
|
|
|
charset utf-8;
|
|
|
# individual nginx logs for this web vhost
|
|
|
#location = /favicon.ico {
|
|
|
#return 404;
|
|
|
#}
|
|
|
#when not specify request uri, redirect to /index;
|
|
|
#location = / {
|
|
|
#rewrite ^ /index ;
|
|
|
#}
|
|
|
#static files
|
|
|
# location /imrest/ {
|
|
|
# proxy_pass http://cosmoHlht_server;
|
|
|
# proxy_set_header X-Real-IP $remote_addr;
|
|
|
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
# proxy_set_header Host $http_host;
|
|
|
|
|
|
# proxy_connect_timeout 600;
|
|
|
# proxy_read_timeout 600;
|
|
|
# proxy_send_timeout 600;
|
|
|
# proxy_buffer_size 64k;
|
|
|
# proxy_buffers 4 32k;
|
|
|
# proxy_busy_buffers_size 64k;
|
|
|
# proxy_temp_file_write_size 64k;
|
|
|
# }
|
|
|
|
|
|
location @fallback{
|
|
|
rewrite .* /index.html break;
|
|
|
}
|
|
|
|
|
|
location / {
|
|
|
root /usr/share/nginx/html;
|
|
|
index index.html index.htm;
|
|
|
#页面找不到的时候依次往下查找
|
|
|
try_files $uri /index.html;
|
|
|
}
|
|
|
location /Debug/ {
|
|
|
root /usr/share/nginx/html;
|
|
|
autoindex on;
|
|
|
autoindex_exact_size off;
|
|
|
autoindex_localtime on;
|
|
|
charset utf-8,gbk;
|
|
|
add_header Content-Disposition attachment;
|
|
|
}
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
location = /50x.html {
|
|
|
root /usr/share/nginx/html;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
# another virtual host using mix of IP-, name-, and port-based configuration
|
|
|
#
|
|
|
#server {
|
|
|
# listen 8000;
|
|
|
# listen somename:8080;
|
|
|
# server_name somename alias another.alias;
|
|
|
|
|
|
# location / {
|
|
|
# root html;
|
|
|
# index index.html index.htm;
|
|
|
# }
|
|
|
#}
|
|
|
|
|
|
|
|
|
# HTTPS server
|
|
|
#
|
|
|
#server {
|
|
|
# listen 443;
|
|
|
# server_name localhost;
|
|
|
|
|
|
# ssl on;
|
|
|
# ssl_certificate cert.pem;
|
|
|
# ssl_certificate_key cert.key;
|
|
|
|
|
|
# ssl_session_timeout 5m;
|
|
|
|
|
|
# ssl_protocols SSLv2 SSLv3 TLSv1;
|
|
|
# ssl_ciphers HIGH:!aNULL:!MD5;
|
|
|
# ssl_prefer_server_ciphers on;
|
|
|
|
|
|
# location / {
|
|
|
# root html;
|
|
|
# index index.html index.htm;
|
|
|
# }
|
|
|
#}
|
|
|
|
|
|
#}
|