Nginx入门教程 àì夳堔傛蜴生んèń 2022-06-11 07:52 110阅读 0赞 # 下载nginx # [http://nginx.org/en/download.html][http_nginx.org_en_download.html] # 解压 # ![这里写图片描述][SouthEast] # 常用命令 # > 启动: start nginx > 重启:nginx -s reload > 终止:nginx -s stop # 配置文件 # 这里只说明nginx.conf文件 #全局变量 worker_processes 1; error_log logs/error.log; error_log logs/error.log notice; error_log logs/error.log info; # 工作链接数 events { worker_connections 1024; } # http监听 http { #http全局参数 include 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; gzip on; #多个代理模块 可以设置分发权重 upstream mkxweb { # sticky; server 127.0.0.1:8082;# tomcat开放的端口 } #监听服务模块 可以通过正则进行匹配 server { listen 80;#端口 用户访问使用的端口 server_name localhost; #保持默认local即可 #一般情况proxy_pass 配合upstream使用 在配合tomcat的时候需要使用 location / { proxy_pass http://mkxweb; # root d:\webappdir; # index index.html index.htm; } #通过正则 拦截包含 /image/的请求 转换资源地址 location ^~ /image/ { root e:/fileproxy; } location ~ /.*\.(mp4|flv|mov|MOV|avi)$ { root e:/fileproxy/video; } 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; } } } # 日志文件 # access.log \#正常通过的日志 error.log \#错误日志 nginx.pid \#nginx用户id [http_nginx.org_en_download.html]: http://nginx.org/en/download.html [SouthEast]: /images/20220611/95801fae33c345edbec5e97ceaf9458b.png
还没有评论,来说两句吧...