码迷,mamicode.com
首页 > 其他好文 > 详细

阿里云域名绑定IP

时间:2017-06-10 16:57:53      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:选择   with   com   index   include   阿里   记录   erro   ams   

前提条件:拥有一个阿里云域名,拥有一台自己的服务器,并且知道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.在网址栏输入自己的域名就可以访问到对应的信息了

 

阿里云域名绑定IP

标签:选择   with   com   index   include   阿里   记录   erro   ams   

原文地址:http://www.cnblogs.com/zhouqi666/p/6978818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!