阿里云域名绑定IP

前提条件:拥有一个阿里云域名,拥有一台本身的服务器,而且知道ip,个人是nginxphp

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

2.选择域名与网站,会看到本身拥有的域名,好比个人是moryingxiao.comnginx

3.点击左侧是解析服务器

4.点击红色的添加解析网站

5.记录类型为A,主机记录为www,记录值为本身的IP地址,而后点击保存阿里云

6.等待10分钟spa

7.在本身的服务器上找到nginx.conf,不知道在哪里的能够执行命令find / -name nginx.confserver

8.htm

 

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

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.在网址栏输入本身的域名就能够访问到对应的信息了

相关文章
相关标签/搜索