一、下载nginx Windows安装器
在nginx官网上可以找到Windows安装器,下载后解压到合适的文件夹。
二、安装nginx
双击nginx安装器,按照提示一步步安装,注意选择正确的安装路径和端口号。
三、配置nginx
1、编辑nginx.conf文件
user 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;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}
}
2、修改nginx.conf文件中的root参数为网站根目录所在路径
location / {
root /www/html;
index index.html index.htm;
}
四、启动nginx
在命令行中进入nginx所在的目录,输入命令start nginx,即可启动nginx。
五、访问nginx服务器
在浏览器中输入localhost或本机IP地址,即可访问nginx服务器。
原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/237480.html
微信扫一扫
支付宝扫一扫