歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網

碼神

日期:2017/3/3 11:26:03   编辑:Linux技術

答:1、申請雲主機和個人域名的方法很簡單,申請地址:https://www.qcloud.com/
登陸這個網址後,使用QQ賬號注冊好並完成實名認證(不實名認證無法按需申請)並登錄開始申請 即可。
我個人的外網是http://182.254.234.190
3、發布個人站點的三種方法如下:
通過Winscp把各種需要的軟件上傳到雲端,下面是需要的各種軟件及安裝包

第一種方法:使用apache
下載並解壓apache-ant-1.9.7-bin.tar.gz文件到創建好的ant文件夾中,其所在目錄及路徑是:/root/yifan/ant

然後開啟httpd服務
服務操作:
開啟服務:systemctl starthttpd.service
查看服務狀態:Systemctl statushttpd.service
開機加載服務:systemctl enablehttpd.service
查看是否開機啟動服務:systemctlis-enabled httpd.service
接著進入 cd/var/www/目錄,創建index.html文件,並進入裡面編輯文件;

完成後就可以訪問自己的站點了。

第二種方法:使用tomcat
1、先進入存放tomcat的目錄cd /yifan

2、然後解壓對應的文件:tar -zxvf apache-tomcat-8.0.28.tar.gz
3、接著進入解壓後文件所在的目錄,cd apache-tomcat-8.0.28/

然後進入apache-tomcat-8.0.28/目錄下的bin目錄 即 cd bin/,並開啟tomcat服務,也就是 sh startup.sh

查看tomcat服務: ps -aux |grep tomcat
4、開放端口
firewall-cmd--add-port=8080/tcp --permanent
5、查看默認站是否開通:http://182.254.234.190
6、增加自己的主頁,並訪問。
在webapp目錄下新建一個目錄a (webapp在apache-tomcat-8.0目錄下,上面的截圖可以看到),並新建一個index.html頁面並寫入內容。訪問:http:// 182.254.234.190:8080/a/index.html


第三種方法:使用nginx
2、安裝nginx
Yum install nginx –y
3、服務管理
先停用掉apache服務:systemctl stop httpd.service
開啟|停用|狀態查看nginx 服務:systemctlstart nginx
查看nginx 服務::systemctl status nginx
4、防火牆打開:
開放端口:firewall-cmd--add-service=http --permanent
5、外網訪問測試:http://192.168.1.240/能否打開靜態頁面
6、發布個人的站點:
vi/etc/nginx/conf.d/default.conf


改為:

然後在 /var/www/html 目錄下新建index.html文件並編輯內容即可,即touch index.html,接著vi index.html
7、重啟服務 systemctlrestart nginx,
firewall-cmd --add-service=http --permanent
8、最後外網測試:
Copyright © Linux教程網 All Rights Reserved