0
点赞
收藏
分享

微信扫一扫

在windows server 2012 服务器上nginx服务部署【鑫手攻略】

AbrahamW 2022-02-02 阅读 98


——本博主使用的就是华为云 云耀服务器,本次攻略以我的云服务器作为栗子仅供大家参考!


一、云服务器

1.注册华为云

https://www.huaweicloud.com/

在这里插入图片描述


在这里插入图片描述


二.在云服务器内 配置nginx服务器

1.进入云服务器 【通过rdp 形式进入

在这里插入图片描述

2.浏览器搜索nginx

第一次进入的同学,可在本地电脑 下载好 谷歌浏览器 的安装包,然后复制到云服务器 磁盘当中。


在这里插入图片描述

3.下载nginx

在这里插入图片描述


在这里插入图片描述

在这里插入图片描述

4.移动nginx 文件

在这里插入图片描述

5.nginx 文件放置

解压后 ,将文件 移到 布置服务的磁盘内

在这里插入图片描述

6.nginx.conf文件修改

例如:server_name www.shadow.org.cn;


在这里插入图片描述


#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       80;
        server_name  www.shadow.org.cn;#ip

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

        # 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;
    #      server_name  www.shadow.org.cn;
    #      ssl_certificate      cert.crt;
    #      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;
    #      }
    #  }

}


三、华为云控制台配置DNS解析


1.找到DNS解析

在这里插入图片描述

2.点击管理解析

在这里插入图片描述

3.快速添加解析

在这里插入图片描述

在这里插入图片描述

解析即可设置成功,届时你可通过自己的域名 访问 到云服务器当中!


如果您喜欢,请收藏!一键三连 你将拥有我.

举报

相关推荐

0 条评论