久久精品精选,精品九九视频,www久久只有这里有精品,亚洲熟女乱色综合一区
    分享

    在Ubuntu 14.04 LTS系統中設置Apache虛擬主機 第2頁

     昵稱27716608 2015-09-18

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

    默認情況下,apache有一個默認的虛擬主機文件叫000-default.conf。我們將會復制000-default.conf文件內容到我們新的虛擬主機配置文件中。

    1. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/unixmen1.local.conf
    2. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/unixmen2.local.conf

    確保虛擬主機配置文件末尾包含.conf擴展名。

    現在,修改unximen1.local.conf文件以符合需求。

    1. sudo vi /etc/apache2/sites-available/unixmen1.local.conf

    使相關的變化直接呈現在unixmen1站點中(譯注:以“#”開頭的注釋行可以忽略。)。

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

    同理,修改第二臺主機文件。

    1. sudo vi /etc/apache2/sites-available/unixmen2.local.conf

    使相關的修改在unixmen2 站點呈現出來。

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

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

    1. sudo a2dissite 000-default.conf
    2. sudo a2ensite unixmen1.local.conf
    3. sudo a2ensite unixmen2.local.conf

    最后,重啟apache服務器。

    1. sudo service apache2 restart

    就是這樣。現在,我們成功地配置了apach虛擬主機在我們的Ubuntu服務器上

    測試虛擬主機

    編輯/etc/hosts文件,

    1. sudo vi /etc/hosts

    在文件末尾添加如下所示的虛擬域名。

    1. 192.168.1.250 unixmen1.local
    2. 192.168.1.250 unixmen2.local

    保存并關閉文件。

    打開你的瀏覽器并訪問http://unixmen1.localhttp://unixmen2.local。你將會看到我們之前創(chuàng)建的示例頁。

    Unixmen1.local 測試頁:

    Unixmen2.local 測試頁

    如果你想從你的遠程系統訪問這些站點,你需要在你的DNS服務器添加實際域名記錄。不過,我沒有真實的域名和DNS服務器,我只想通過我的本地系統測試,那么它剛好如我所愿地工作。

    Cheers!

    更多Ubuntu相關信息見Ubuntu 專題頁面 http://www./topicnews.aspx?tid=2

    本文永久更新鏈接地址http://www./Linux/2014-06/102871.htm

    linux

      本站是提供個人知識管理的網絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯系方式、誘導購買等信息,謹防詐騙。如發(fā)現有害或侵權內容,請點擊一鍵舉報。
      轉藏 分享 獻花(0

      0條評論

      發(fā)表

      請遵守用戶 評論公約

      類似文章 更多

      主站蜘蛛池模板: 国产一区日韩二区欧美三区| 人妻丝袜无码专区视频网站| 99久久精品国产综合一区| 亚州中文字幕一区二区| 任你躁国产自任一区二区三区| 波多野结衣AV一区二区全免费观看 | 久久精品国产亚洲AV瑜伽| 亚洲AV无码成人精品区蜜桃| 免费AV片在线观看网址| 55夜色66夜色国产精品视频| 亚洲国产成人资源在线| 亚洲AV无码AV在线影院| 久久蜜臀av一区三区| 久久毛片少妇高潮| 国产亚洲精品午夜福利| 国产偷窥熟女高潮精品视频| 国内精品一区二区不卡| 国产高潮抽搐喷水高清| 国产欧美综合在线观看第十页| 国产精品欧美一区二区三区不卡 | 男人把女人桶到喷白浆的软件免费| 国内少妇人妻偷人精品| 丰满少妇人妻HD高清大乳在线| 日韩有码中文字幕国产| 亚洲AV成人噜噜无码网站| 日韩人妻中文字幕精品| 自拍偷自拍亚洲精品播放| 久久亚洲精品情侣| 亚洲中文字幕一区二区| 日本不卡一区二区三区| 欧美午夜成人片在线观看| 亚洲人妻系列中文字幕| 欧美成人家庭影院| 国产精品爽黄69天堂A| 亚洲国产日韩一区三区| 桃子视频在线播放WWW| 老色鬼永久精品网站| 乱码视频午夜在线观看| 中文字幕国产精品日韩| 久久精品国产亚洲AV无码偷窥| 国产福利萌白酱在线观看视频|