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

最新文章

  1. Lua简介
  2. JavaWeb 学习009-4个页面,5条sql语句(添加、查看、修改、删除)
  3. IIS发布WCF服务项目之本地
  4. 私有Pods封装个推SDK功能(解决方案)
  5. wp8 入门到精通 定时更新瓷贴
  6. js列表分页
  7. BZOJ 1048 分割矩阵
  8. paip输入法编程之生活用高频字,以及汉字分级
  9. Windows下Vundle安装
  10. PHP 学习笔记(2)
  11. 插入排序Insertion Sort
  12. Redis从入门到精通:初级篇
  13. 学JAVA第二十天,接触异常处理,自定义异常
  14. Swift构造
  15. SSH框架之hibernate《二》
  16. keepalive配置mysql自动故障转移
  17. hdu 5584 LCM Walk
  18. linux下的网络通信设置:openssh、PuTTY、tightVNC
  19. 【学习笔记】--- 老男孩学Python,day3 while 循环 运算符 逻辑、赋值运算
  20. React-Native开发之原生模块封装(Android)升级版

热门文章

  1. NSOperation 开发
  2. [bzoj3456] 城市规划 [递推+多项式求逆]
  3. ndk开发-ffmpeg编译
  4. SPOJ 1825 Free Tour | 终极之树分治
  5. latex公式测试
  6. select下拉框右对齐,去掉箭头,替换箭头
  7. 如何从oracle官网中下载The java language specification(java 语言规范)
  8. placeholer改变默认灰色
  9. Java并发(3)- 聊聊Volatile
  10. 【ZOJ4067】Books(贪心)