一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

ubuntu 13.04 配置apache 虚拟主机方法

时间:2022-06-30 19:30:10 编辑:袖梨 来源:一聚教程网

 

 代码如下 复制代码

#创建目录#
$mkdir /var/www/phperstar

#创建虚拟主机配置文件#
$cd /etc/apache2/sites-enabled/
$vi websitename

#复制一下内容,贴入配置文件,保存退出#

        ServerAdmin webmaster@localhost
        ServerName www.111com.net    #改成自己想用的域名#
        DocumentRoot /var/www/phperstar  #放置程序用的目录#
       
                Options FollowSymLinks
                AllowOverride None
       

          #放置程序用的目录#
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
       

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

        ErrorLog ${APACHE_LOG_DIR}/www.111com.net_error.log   #错误日志目录#

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

        CustomLog ${APACHE_LOG_DIR}/www.111com.net_access.log combined  #访问日志目录#

#启用配置文件#
$cd /etc/apache2
$sudo a2ensite websitename
Enabling site phperstar.
To activate the new configuration, you need to run:
  service apache2 reload

#重启apache#
$sudo service apache2 reload
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]

#绑定hosts#
$vi /etc/hosts

#加入下面自己配置的域名,保存推出#
127.0.1.1  www.111com.net

然后浏览器访问域名,就行了

热门栏目