ubuntu apache2 多域名

linode

add a new linode

sudo apt-get update  // apt-get install 前 update

sudo apt-get install apache2 


綁定域名

1 vim  /ect/apache2/apache.conf

添加行:

<Directory /srv/www/>

        Options Indexes FollowSymLinks

        AllowOverride None

        Require all granted

</Directory>


(注:缺這一步,瀏覽器訪問報錯:

Forbidden

You don't have permission to access / on this server.


cd /srv

mkdir www

cd www

mkdir  exaple.com

cd exaple.com

mkdir public.html

mkdir logs

vim index.html


3 cd /etc/apache2/sites-avaible

vim example.com.conf

<VirtualHost *:80>

     ServerAdmin [email protected]

     ServerName example.org

     ServerAlias www.example.org

     DocumentRoot /srv/www/example.org/public_html/

     ErrorLog /srv/www/example.org/logs/error.log

     CustomLog /srv/www/example.org/logs/access.log combined

</VirtualHost>


sudo /etc/init.d/apache2 restart


再用瀏覽器訪問 example.org 就可以看到頁面。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章