• 阿里云域名绑定IP


    前提条件:拥有一个阿里云域名,拥有一台自己的服务器,并且知道ip,我的是nginx

    1.登陆阿里云https://www.aliyun.com/

    2.选择域名与网站,会看到自己拥有的域名,比如我的是moryingxiao.com

    3.点击左侧是解析

    4.点击红色的添加解析

    5.记录类型为A,主机记录为www,记录值为自己的IP地址,然后点击保存

    6.等待10分钟

    7.在自己的服务器上找到nginx.conf,不知道在哪里的可以执行命令find / -name nginx.conf

    8.

    9.进入nginx.conf,在最下面一行看到

    include /etc/nginx/conf.d/*.conf;

    每个人的实际情况不同

    10.进入当前目录下的conf.d,新建立一个more.conf文件,名字可以随便起

    11.nginx.conf的配置内容如下

    #

    # The default server

    #

    server {

        listen   80;

        server_name  moreyingxiao.com   www.moreyingxiao.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        # Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;

        location / {

             root /var/www/html/more;

            index index.php index.html index.htm;

        }

        error_page  404              /404.html;

        location = /404.html {

            root   /usr/share/nginx/html;

        }

        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   /usr/share/nginx/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 /var/www/html/more;

             fastcgi_pass   127.0.0.1:9000;

             fastcgi_index  index.php;

             fastcgi_split_path_info ^(.+.php)(.*)$;     #增加这一句

             fastcgi_param PATH_INFO $fastcgi_path_info;    #增加这一句

             fastcgi_param  SCRIPT_FILENAME  $document_root$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;

        #}

    }

    13.由于不是很熟悉nginx的配置,所以只是大概配置

    主要就是servername配置为自己的域名,并且location下面的root根目录路径指向。

    这里我指向的是/var/www/html/more

    14./var/www/html/新建立一个more文件夹,里面建立一个index.html,随便输入一些信息

    15.在网址栏输入自己的域名就可以访问到对应的信息了

  • 相关阅读:
    几种 JavaScript 动画库推荐
    微软工程师为你推荐了十本程序员必读书目
    前端新老手必备的34种JavaScript简写优化技术
    Airbnb 爱彼迎 visx 项目介绍
    开源中间件技术支持(5000+元/天)
    C# Byte数组与Int16数组之间的转换(转)
    【636】K.sum 与 np.sum 的区别
    【635】语义分割 label 通道与模型输出通道的
    【634】ndarray 提取行列进行任意变换 & 相关 ndarray 操作
    面试官:设计一个安全的登录都要考虑哪些?我一脸懵逼。。
  • 原文地址:https://www.cnblogs.com/zhouqi666/p/6978818.html
Copyright © 2020-2023  润新知