下载地址 http://nginx.org/en/download.html 选择windows版本
下载后文件目录结构如下图

来看下conf下的nginx.conf 这是nginx的主要配置文件
worker_processes 1;#工作进程数
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;#监听80端口
server_name 域名;
location /
{
proxy_pass http://127.0.0.1:8080/xxx/index.jsp;#需要代理的本地资源
proxy_cookie_path / /;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
proxy_pass http://127.0.0.1:8080;
}
location ~ .*\.(js|css)$
{
proxy_pass http://127.0.0.1:8080;
}
}
include xxx.conf;#引用外部配置文件
}
在当前文件夹下 使用dos命令 输入nginx 启动(黑色界面一闪而过)
以上就介绍了windows环境下使用nginx,包括了Windows方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号