阿里雲域名綁定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.在網址欄輸入自己的域名就可以訪問到對應的信息了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM