1.安装所需要的软件:
sudo apt-get install apache2 mysql-server phpmyadmin
2.配置apache
创建网站的根目录:
sudo mkdir /var/www/blog.nixonli.com
修改目录权限:
sudo chown -R /var/www/blog.nixonli.com
编辑/etc/hosts文件在最后添加域名如下:
[...} 127.0.0.1 blog.nixonli.com [...]
2.4.添加虚拟主机编辑添加文件“/etc/apache2/sites-available/blog.nixonli.com.conf”:
ServerAdmin webmaster@localhost ServerName www.nixonli.com DocumentRoot /var/www1/www.nixonli.com Options Indexes FollowSymLinks MultiViews #AllowOverride None AllowOverride FileInfo Order allow,deny allow from all
配置文件生效:
sudo a2ensite blog.nixonli.com
关闭虚拟主机
sudo a2dissite blog.nixonli.com
配置重建模块:
sudo a2enmod rewrite
关闭模块
sudo a2dismod rewrite
重启apache:
sudo /etc/init.d/apache2 restart
未经允许不得转载:窗外天空 » 在Ubuntu系统中安装和配置PHP;Apache;MySQL