美文网首页
windows安装Nginx服务

windows安装Nginx服务

作者: Lee_5566 | 来源:发表于2021-02-19 20:54 被阅读0次
image.png

下载

官网下载安装包。

image.png

解压

解压安装包到一个没有中文的目录里。
比如我的目录为:E:\nginx-1.18.0


image.png

配置

修改下E:\nginx-1.18.0\conf目录下的nginx.conf文件,配置下本地的对应目录和端口。
比如我的配置端口为8080,对应的web目录为F:/www


#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;

    server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   F:/www;
            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;
        }

        # 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;
    #    }
    #}

}

执行

打开浏览器,输入http://localhost:8080/
就可以打开对应的网页了。注意:web目录下放入提前准备好的网页
比如我放入的h5小游戏源码:

image.png

相关文章

  • nginx从入门到精(fang)通(qi)

    1. nginx的安装 windows下nginx的安装及使用 windows server服务器安装nginx出...

  • Nginx + Vue项目部署

    在windows服务器上部署Vue项目 第一步: 安装Nginx 下载 Nginx Windows 包 官网 在服...

  • 记录Nginx学习

    由于公司的服务器是windows环境,所以学习nginx的过程也是在windows中进行。 1.下载安装Nginx...

  • windows安装Nginx服务

    下载 从官网[http://nginx.org/en/download.html]下载安装包。 解压 解压安装包到...

  • nginx使用

    Nginx在windows下的安装、运行,以及配置文件讲解 安装Nginx(windows版) 进入Nginx官网...

  • nginx for windows

    一.介绍安装 公司由于linux云服务器还没批下来,暂时先在windows服务器上测试。Windows版nginx...

  • windows下使用Nginx服务器实现负载均衡方法

    安装与基本配置 首先下载windows的版本Nginx服务器 下载地址如下: http://www.nginx.o...

  • window安装nginx

    如果自己想要学习nginx,有没有相应的linux服务器,可以在自己的windows上面安装nginx。 下载ng...

  • Nginx的安装(Windows)

    Nginx的安装(Windows) 操作系统:Windows10,Nginx软件包:nginx-1.8.0.zip...

  • 【Nginx】2、Nginx安装

    【Nginx】2、Nginx安装 这里简单介绍Nginx在Windows、CentOS、Mac上的安装。 Ngin...

网友评论

      本文标题:windows安装Nginx服务

      本文链接:https://www.haomeiwen.com/subject/otfzxltx.html