為了不讓域名fangyuanxiaozhan.com閑置, 作者又買了個(gè)國(guó)內(nèi)的虛擬主機(jī)(VPS)的ip為 111.230.254.173
, 用wordpress開了個(gè)博客網(wǎng)站, 由于vps的空間很大, 我就開了個(gè)私有網(wǎng)盤服務(wù), 由于日常開發(fā)需要用到git, 但又不想公開代碼, 我又開了個(gè)私有g(shù)it服務(wù)
我的vps掛了三個(gè)服務(wù), 分別是:
我的需求:
實(shí)現(xiàn)的方法
1、到托管域名的網(wǎng)站, 添加DNS解析, 我的域名 fangyuanxiaozhan.com 托管在阿里云, 我的做法是登錄 https://dns.console.aliyun.com/#/dns/domainList , 添加二級(jí)記錄
2、我使用的是centos7, nginx配置文件的默認(rèn)位置為 /etc/nginx/nginx.conf
, 有意思的是, /etc/nginx/nginx.conf
內(nèi)引入了 配置文件夾 /etc/nginx/conf.d
, 也就是我們可以把 /etc/nginx/nginx.conf
中的一些默認(rèn)配置注釋掉, 直接在文件夾 /etc/nginx/conf.d
中配置多個(gè)獨(dú)立的配置文件.
/etc/nginx/nginx.conf
的配置
# For more information on configuration, see:# * Official English Documentation: http://nginx.org/en/docs/# * Official Russian Documentation: http://nginx.org/ru/docs/user nginx;worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;# Load dynamic modules. See /usr/share/nginx/README.dynamic.include /usr/share/nginx/modules/*.conf;events { worker_connections 1024;}http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf;}
注意上述配置文件的最后一行, include /etc/nginx/conf.d/*.conf;
保證了 /etc/nginx/conf.d/
下,所有以.conf結(jié)尾的配置文件, 都會(huì)被主配置文件 nginx.conf
引入并生效
在 /etc/nginx/conf.d/
新聞熱點(diǎn)
疑難解答
圖片精選