關於Linux下Apache的站點開啓方法

關於apache2: Could not reliably determine the server’s fully qualified domain name 解決方法

首先來到apache配置文件:

vim /etc/apache2/apache2.conf

在文件的末尾出,添加一句:ServerName localhost:80即可。

獨立開啓小站:

<VirtualHost *:80>  
    ServerAdmin webmaster@localhost  
    ServerName blog.liang  
    DocumentRoot /var/www/ourblog  
    <Directory />  
        Options FollowSymLinks  
        AllowOverride None  
    </Directory>  
    <Directory /var/www/ourblog>  
        Options Indexes FollowSymLinks MultiViews  
        AllowOverride None  
        Order allow,deny  
        allow from all  
    </Directory>  

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/  
    <Directory "/usr/lib/cgi-bin">  
        AllowOverride None  
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch  
        Order allow,deny  
        Allow from all  
    </Directory>  

    ErrorLog ${APACHE_LOG_DIR}/error.log  

    # Possible values include: debug, info, notice, warn, error, crit,  
    # alert, emerg.  
    LogLevel warn  

    CustomLog ${APACHE_LOG_DIR}/access.log combined  

     Alias /doc/ "/usr/share/doc/"  
    <Directory "/usr/share/doc/">  
        Options Indexes MultiViews FollowSymLinks  
        AllowOverride None  
        Order deny,allow  
        Deny from all  
        Allow from 127.0.0.0/255.0.0.0 ::1/128  
    </Directory>  

</VirtualHost>  
cd /etc/apache2/sites-available

//複製一份default,命名爲新的域名
sudo cp default blog.liang

//修改好之後啓動該站點
a2ensite blog.liang

//重新加載Apache
sudo service apache2 reload

//or重啓Apache
sudo service apache2 restart

//可以用ping命令來測試是否能連接
ping blog.liang
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章