
Windows 下载、安装、配置 Nginx1.18.0
发布日期:2021-05-08 02:11:48
浏览次数:22
分类:精选文章
本文共 3686 字,大约阅读时间需要 12 分钟。
Nginx下载
Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the and (1.15.9) connection processing methods are currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version. At this time, it provides almost the same functionality as a UNIX version of nginx except for XSLT filter, image filter, GeoIP module, and embedded Perl language. select()poll()
安装与启动
将下载好的文件,在合适的地方进行解压,解压后,打开文件夹,双击nginx即可启动nginx文件:

nginx命令
# 查看帮助信息nginx -h# 查看nginx版本nginx -v# 启动nginxstart nginx# 关闭nginx,完整有序的停止nginx,保存相关信息nginx -s quit# 关闭nginx,快速停止nginx,可能不保存相关信息nginx -s stop# 重新载入nginx,当配置信息需要重新加载配置时使用nginx -s reload# 测试nginx配置文件是否正确nginx -t -c filename# 重新打开日志文件nginx -s reopen
修改nginx配置
解压文件夹下:
/conf/nginx.conf 文件即是nginx配置文件;#user nobody;# worker_processes指明了nginx要开启的进程数,官方的建议是修改成CPU的内核数;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;}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; server { listen 8080; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; # 原始代码 # location / { # root html; # index index.html index.htm; # } # 设置代理 location / { proxy_pass http://localhost:8001; } location /api/ { proxy_pass http://localhost:8000; proxy_set_header Host $host; } #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$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$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; #} } # 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 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; # } #}}
发表评论
最新留言
很好
[***.229.124.182]2025年03月28日 23时26分14秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Unity之PlayerPrefs
2021-05-08
简单的xml读取存储方法(未优化)
2021-05-08
Flower
2021-05-08
Nginx---惊群
2021-05-08
Redis未授权漏洞
2021-05-08
供应ASTM D3475认证丨ASTM D3475防儿童包装测试费用
2021-05-08
2种解法 - 获取一条直线上最多的点数
2021-05-08
项目中常用的审计类型概述
2021-05-08
新生儿不建议吃鱼肝油,这些你知道吗
2021-05-08
新生儿哭是因为什么
2021-05-08
基础知识
2021-05-08
nodeName与tagName的区别
2021-05-08
(九)实现页面底部购物车的样式
2021-05-08
在vue中给对象扩展属性的方法
2021-05-08
Neo4j : 通过节点的 id属性 对节点进行查,改,删操作
2021-05-08
Linux标准错误和标准输出重定向到同一个文件
2021-05-08
HTTP Status 404 – Not Found
2021-05-08