标签:alias space 功能 默认端口 gzip压缩 and for conf with
#user nobody;#配置worker进程运行用户
worker_processes 1;#配置工作进程数目,根据硬件调整、通常等于CPU数量或者2倍于CPU数量 比如四核电脑(可以配置4或者8)
#error_log logs/error.log; #配置日志类型、默认为error级别
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;#配置进程pid文件 【进程编号】
#事件配置:
events {
worker_connections 1024; #配置worker进程连接数量上线,nginx链接的总数等于worker_connections*worker_processes 的值
}
#配置http服务器,利用他的反向代理功能提供负载均衡支持
http {
#http基本配置
include mime.types;#配置nginx支持哪些多媒体类型
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日志及存放路径、并使用上面定义的main日志格式
#access_log logs/access.log main;
sendfile on;#开启高效文件传输模式
#tcp_nopush on;#防止网络阻塞
#keepalive_timeout 0;
keepalive_timeout 65;#长连接超时时间
#gzip on;#开启gzip压缩输出
#多个server配置
server {
listen 8089;
server_name localhost;
location /{#web项目代理地址
proxy_pass http://localhost:8080/;
}
}
server {
listen 8088;
server_name localhost;
#charset koi8-r;
location /ecustom/workflow/form/js {
root D:/OADev/Workspace/ecology-innovation/WebContent;
}
location /{
proxy_pass http://172.16.0.80:8443;
}
#配置404页面
#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 {#配置50开头的错误页面
root html;
}
#php脚本请求全部转发到Apache处理
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
#php脚本请求全部转发到FastCGI处理
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
#禁止访问.htaccess文件
# deny access to .htaccess files, if Apache‘s document root
# concurs with nginx‘s one
#
#location ~ /\.ht {
# deny all;#拒接所有文件
#}
}
# 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;#配置服务器默认网站根目录位置,默认为ngnix安装
# index index.html index.htm;#配置首页文件的名称
# }
#}
#配置https服务 ---运维工作
# HTTPS server
#
#server {
# listen 443 ssl;#默认端口
# server_name localhost;
# ssl_certificate cert.pem;#证书
# ssl_certificate_key cert.key;#密钥
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
标签:alias space 功能 默认端口 gzip压缩 and for conf with
原文地址:https://www.cnblogs.com/yhm9/p/11142230.html