Ubuntu环境下在Apache下部署Ecshop网站
在Apache目录下文件列表
zend@ubuntu:/etc/apache2$ ls -l total 72 -rw-r--r-- 1 root root 8113 2011-11-03 11:28 apache2.conf drwxr-xr-x 2 root root 4096 2011-11-22 11:46 conf.d -rw-r--r-- 1 root root 725 2011-11-03 11:28 envvars -rw-r--r-- 1 root root 21 2012-02-14 15:53 httpd.conf -rw-r--r-- 1 root root 31063 2011-11-03 11:28 magic drwxr-xr-x 2 root root 4096 2012-02-15 10:38 mods-available drwxr-xr-x 2 root root 4096 2011-11-28 15:47 mods-enabled -rw-r--r-- 1 root root 750 2012-03-02 11:37 ports.conf drwxr-xr-x 2 root root 4096 2012-04-26 15:07 sites-available drwxr-xr-x 2 root root 4096 2012-04-26 15:04 sites-enabled
首先为Apache扩展伪静态模块:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-available/mods-enabled
mods-enabled目录内的都是mods-available目录内文件的软链接。
mods-enabled目录内的模块都是会在Apache启动时加载的。
zend@ubuntu:/etc/apache2$ cd sites-available zend@ubuntu:/etc/apache2/sites-available$ ls -l total 40 -rw-r--r-- 1 zend root 946 2012-02-29 17:17 default -rw-r--r-- 1 root root 1533 2012-02-29 17:17 default~ -rw-r--r-- 1 root root 7467 2011-11-03 11:28 default-ssl
zend@ubuntu:/etc/apache2/sites-available$ sudo cp default shop.com
zend@ubuntu:/etc/apache2/sites-available$ sudo vim shop.com
<VirtualHost www.shop.com:80> ServerName www.shop.com DocumentRoot /var/www/shop <Directory /var/www/shop> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
sudo a2ensite shop.com 使该配置有效
sudo a2dissite shop.com使该配置无效
以上两命令主要是在sites-enable目录下生成软链接。Apache会用加载该目录下的配置信息
还有常用到的:
sudo /etc/init.d/apache2 reload sudo /etc/init.d/apache2 restart sudo /etc/init.d/apache2 stop