1.下载nginxhtml
http://nginx.org/en/download.htmlnginx
2.查看系统80端口占用状况app
netstat -ano |findstr "80"tcp
若是是其余软件占了端口号 直接关掉进程就OKide
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4orm
若是端口占用是系统 server
net stop http 中止http 服务htm
下面的服务依赖于 HTTP Service 服务。
中止 HTTP Service 服务也会中止这些服务。blog
World Wide Web 发布服务
SSDP Discovery
Print Spooler进程
你想继续此操做吗? (Y/N) [N]: Y
并禁用服务
Sc config http start= disabled
中止后重启电脑 发现80端口正常了
启动nginx nginx.exe
启动成功页面
配置nginx
打开 D:\nginx-1.16.0\conf\nginx.conf
#user nobody;
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;
upstream xxx.xxx.com {
server 127.0.0.1:81;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://xxx.xxx.com;
}
#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;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#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;
}
}
}
配置完成以后 nginx -s reload
以后就能够正常访问了
启动 net start http
C:\WINDOWS\system32>net start http
发生系统错误 1058。
没法启动服务,缘由多是已被禁用或与其相关联的设备没有启动。
须要修改服务配置
sc config http start= demand & net start http
服务正常启动