前提條件:擁有一個阿里雲域名,擁有一臺本身的服務器,而且知道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.在網址欄輸入本身的域名就能夠訪問到對應的信息了