欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

ubuntu14.04中怎么設(shè)置Apache虛擬主機

本篇文章給大家分享的是有關(guān)ubuntu 14.04中怎么設(shè)置Apache虛擬主機,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

創(chuàng)新互聯(lián)建站主營淮濱網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都App定制開發(fā),淮濱h5微信小程序定制開發(fā)搭建,淮濱網(wǎng)站營銷推廣歡迎淮濱等地區(qū)企業(yè)咨詢



安裝Apache網(wǎng)站服務(wù)器

安裝apache服務(wù)器之前,我們來更新一下我們的Ubuntu服務(wù)器:
sudo apt-get update然后,用下面命令來安裝apache網(wǎng)絡(luò)服務(wù)器:
sudo apt-get install apache2安裝apache服務(wù)器之后,讓我們通過這個URL http://你的服務(wù)器的IP地址/ 來測試網(wǎng)站服務(wù)器是否正常工作

ubuntu 14.04中怎么設(shè)置Apache虛擬主機


如你所見,apache服務(wù)器已經(jīng)工作了。

設(shè)置虛擬主機

1.創(chuàng)建虛擬目錄

現(xiàn)在,讓我們繼續(xù)安裝虛擬主機。正如我先前所述,我要新建2臺虛擬主機分別命名為“unixmen1.local”和“unixmen2.local”.

創(chuàng)建一個公用的文件夾來存放這兩臺虛擬主機的數(shù)據(jù)。

首先,讓我們?yōu)閡nixmen1.local這個站點創(chuàng)建一個目錄:

sudo mkdir -p /var/www/unixmen1.local/public_html接著,為for unixmen2.local站點創(chuàng)建一個目錄:
sudo mkdir -p /var/www/unixmen2.local/public_html

2. 設(shè)置所有者和權(quán)限

上面目錄現(xiàn)在只有root擁有權(quán)限。我們需要修改這2個目錄的擁有權(quán)給普通用戶,而不僅僅是root用戶。

sudo chown -R $USER:$USER /var/www/unixmen1.local/public_html/
sudo chown -R $USER:$USER /var/www/unixmen2.local/public_html/

“$USER”變量指向了當(dāng)前的登錄用戶。

設(shè)置讀寫權(quán)限給apache網(wǎng)頁根目錄(/var/www)及其子目錄,這樣每個人都可以從目錄中讀取文件。

sudo chmod -R 755 /var/www/這樣,我們就創(chuàng)建好了一些文件夾來保存網(wǎng)絡(luò)相關(guān)數(shù)據(jù)并分配必要的權(quán)限和所屬用戶。

4. 為虛擬主機創(chuàng)建示例頁

現(xiàn)在,我們給網(wǎng)站增加示例頁。第一步,讓我們給虛擬主機unixmen1.local創(chuàng)建一個示例頁。

給unixmen1.local虛擬主機創(chuàng)建一個示例頁,

sudo vi /var/www/unixmen1.local/public_html/index.html添加以下內(nèi)容:

XML/HTML Code復(fù)制內(nèi)容到剪貼板

  1. <html>    

  2.   <head>    

  3.     <title>www.unixmen1.local</title>    

  4.   </head>    

  5. <body>    

  6.     <h2>Welcome To Unixmen1.local website</h2>    

  7. </body>  

  8. </html>  

保存并關(guān)閉文件。
同樣的,添加示例頁到第二臺虛擬主機。
sudo vi /var/www/unixmen2.local/public_html/index.html添加以下內(nèi)容:

代碼如下:


<html>
<head>
 <title>www.unixmen2.local</title>
</head>
<body>
 <h2>Welcome To Unixmen2.local website</h2>
</body>
</html>

保存并關(guān)閉文件。

5. 創(chuàng)建虛擬主機配置文件

默認情況下,apache有一個默認的虛擬主機文件叫000-default.conf。我們將會復(fù)制000-default.conf文件內(nèi)容到我們新的虛擬主機配置文件中。
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/unixmen1.local.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/unixmen2.local.conf確保虛擬主機配置文件末尾包含.conf擴展名。
現(xiàn)在,修改unximen1.local.conf文件以符合需求。

sudo vi /etc/apache2/sites-available/unixmen1.local.conf使相關(guān)的變化直接呈現(xiàn)在unixmen1站點中(譯注:以“#”開頭的注釋行可以忽略。)。

代碼如下:


<VirtualHost *:80>        
# The ServerName directive sets the request scheme, hostname and port that        
# the server uses to identify itself. This is used when creating        
# redirection URLs. In the context of virtual hosts, the ServerName        
# specifies what hostname must appear in the request's Host: header to        
# match this virtual host. For the default virtual host (this file) this        
# value is not decisive as it is used as a last resort host regardless.        
# However, you must set it for any further virtual host explicitly.        
#
ServerName www.example.com        
ServerAdmin webmaster@unixmen1.local        
ServerName unixmen1.local        
ServerAlias www.unixmen1.local        
DocumentRoot /var/www/unixmen1.local/public_html        
# Available loglevels: trace8, &hellip;, trace1, debug, info, notice, warn,        
# error, crit, alert, emerg.      
# It is also possible to configure the loglevel for particular        
# modules, e.g.        
#
#LogLevel info ssl:warn        
ErrorLog ${APACHE_LOG_DIR}/error.log        
CustomLog ${APACHE_LOG_DIR}/access.log comb
# For most configuration files from conf-available/, which are        
# enabled or disabled at a global level, it is possible to        
# include a line for only one particular virtual host. For example the        
# following line enables the CGI configuration for this host only        
# after it has been globally disabled with "a2disconf".        
#
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

修改虛擬主機文件后,禁用默認的虛擬主機配置(000.default.conf),然后啟用新的虛擬主機配置,如下所示。

代碼如下:


sudo a2dissite 000-default.conf
sudo a2ensite unixmen1.local.conf
sudo a2ensite unixmen2.local.conf

最后,重啟apache服務(wù)器。
sudo service apache2 restart

就是這樣?,F(xiàn)在,我們成功地配置了apach虛擬主機在我們的Ubuntu服務(wù)器上
測試虛擬主機
編輯/tc/hosts文件,
sudo vi /etc/hosts在文件末尾添加如下所示的虛擬域名。
192.168.1.250   unixmen1.local192.168.1.250   unixmen2.local保存并關(guān)閉文件。
打開你的瀏覽器并訪問http://unixmen1.local 或 http://unixmen2.local。你將會看到我們之前創(chuàng)建的示例頁。

Unixmen1.local 測試頁:

ubuntu 14.04中怎么設(shè)置Apache虛擬主機

以上就是ubuntu 14.04中怎么設(shè)置Apache虛擬主機,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

標(biāo)題名稱:ubuntu14.04中怎么設(shè)置Apache虛擬主機
URL網(wǎng)址:http://aaarwkj.com/article32/jjippc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、小程序開發(fā)網(wǎng)站維護、面包屑導(dǎo)航網(wǎng)頁設(shè)計公司、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)
精品人妻一区二区三区观看| 国产午夜激情在线播放| 成人黄色小视频下载| 国产精品一区二区剧情熟女 | 日韩不卡的一区免费视频| 亚洲一区二区福利视频| 国产原创av剧情愿望成真| 一卡二卡精品在线免费| 国产系列在线播放一区二区三区| 亚洲男人天堂最新地址| 人妻少妇被粗大爽av| 亚洲国产精品成人久久蜜臀| 亚洲黄色av网站在线| 亚洲福利视频在线观看免费 | 国产成人在线免费短视频| 欧美美女福利午夜视频| 久久久久亚洲av成人| 日韩中文免费av一区| 国产91九色在线播放| 亚洲人色中文字幕天堂| 麻豆一区二区人妻网站| 强d乱码中文字幕在线| 亚洲一区成人免费电影| 亚洲av日韩综合一区尤物| 蜜臀人妻久久一区二区三| 国产精品美女丝袜久久久| 婷婷中文字幕在线不卡视频| 尹人大香蕉在线视频| 亚洲成人av综合在线| 欧美日韩一区二区三区四区高清| 蜜桃av网站免费观看| 亚洲精品成人午夜久久| 丝袜美腿一区在线播放| 午夜福利视频欧美成人| 黄色免费大片在线播放| 美女av在线免费观看| 天堂久久天堂av色综合| 久久这里只有精品伊人网| 久久91亚洲精品中文字幕| 国产精品国产一级国产av| 欧美精品一区二区精品久久|