- 安装
yum -y isntall httpd
yum -y install mariadb mariadb-server
yum -y php php-mysql
******************************
systemctl start httpd systemctl enable httpd
systemctl start mariadb
mysql_secure_installation
apache 默认网站存放目录 /var/www/html
测试php 新建 test.php 输入代码
<?php phpinfo(); ?>
重启 httpd
2. 配置虚拟主机(/etc/httpd/conf.d/vhost.conf )
vim /etc/httpd/conf.d/vhost.conf
# 主机 1
# zning.net
#
<VirtualHost *:80>
ServerAdmin admin@zning.net
ServerName zning.net
ServerAlias www
# 注意下面这行末尾不要带 /
DocumentRoot /srv/www/zning.net/html
<Directory "/srv/www/zning.net/html/">
Options FollowSymLinks
# 下一行这样设置就可以在网站文件的目录中使用 .htaccess
AllowOverride All
# 下一行是替代 Allow from all 的新机制
Require all granted
</Directory>
ErrorLog /srv/www/zning.net/logs/error.log
CustomLog /srv/www/zning.net/logs/access.log combined
ServerSignature Off
</VirtualHost>
#
# 主机 2
# qcloud.zning.net
# 这是另一个位于同一服务器的网站,如果不需要则删除此段配置
#
<VirtualHost *:80>
ServerAdmin admin@zning.net
ServerName test.zning.net
ServerAlias test
DocumentRoot /srv/www/qcloud.zning.net/html
<Directory "/srv/www/qcloud.zning.net/html/">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /srv/www/qcloud.zning.net/logs/error.log
CustomLog /srv/www/qcloud.zning.net/logs/access.log combined
ServerSignature Off
</VirtualHost>
#
# 主机 3
# 为了以后给访问 phpMyAdmin 的时候用,也可以是别的端口,如 4444
Listen 3366
#
# phpMyAdmin,访问地址:http://12.34.56.78:3366/phpMyAdmin
#
<VirtualHost 12.34.56.78:3366>
ServerAdmin admin@zning.net
DocumentRoot /srv/www/phpmyadmin/html
<Directory "/srv/www/phpmyadmin/html/">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog /srv/www/phpmyadmin/logs/error.log
CustomLog /srv/www/phpmyadmin/logs/access.log combined
ServerSignature Off
</VirtualHost>
虽然配置文件写好了,但是还不能启动 httpd 进程,因为上面设置的各个文件夹(网站目录)还没有创建。
创建各个虚拟主机的文件夹(根据需要增加或删除),
# 主机 1 的
# mkdir /srv/www/zning.net/html -p
# mkdir /srv/www/zning.net/logs
# 主机 2 的
# mkdir /srv/www/qcloud.zning.net/html -p
# mkdir /srv/www/qcloud.zning.net/logs
# 主机 3 的
# mkdir /srv/www/phpmyadmin/html -p
# mkdir /srv/www/phpmyadmin/logs
- 安装和配置 phpMyAdmin
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y phpmyadmin
然后修改配置文件(vim /etc/httpd/conf.d/phpMyAdmin.conf)
注释掉这两行
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
Directory /usr/share/phpMyAdmin/>
接下来修改………
里面的
Require ip 127.0.0.1
Require ip ::1
改成
Require all granted (只要是apache2.4 下面都必须改)
- 安装WordPress
cd /srv/www/qcloud.zning.net/html
下载WordPress
# wget https://cn.wordpress.org/wordpress-4.5.2-zh_CN.tar.gz
解压文件
# tar zxvf wordpress-4.5.2-zh_CN.tar.gz
移动文件
# mv /srv/www/qcloud.zning.net/html/wordpress/* /srv/www/qcloud.zning.net/html
# chmod -R 777 /srv/www/qcloud.zing.net/html 或者(vim /srv/www/qcloud.zning.net/html/wp-config.php来创建,并复制WordPress已经提供的内容,保存继续即可)
- 安装discuz
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
unzip Discuz_X3.2_SC_GBK.zip
chmod -R 777 /srv/www/zning.net/html
参考文献:
http://www.cnblogs.com/laramia/p/5035744.html
https://mp.weixin.qq.com/s?__biz=MzIyMjQ3MzAzMw==&mid=2247483685&idx=1&sn=42ba53af07aa8e167bbe50a7a6822cb3&chksm=e82dbf03df5a3615e061a2a7fbea310c1a2a00832da0f6b19d9cfb206ca4f38e0875aefeb0f8&mpshare=1&scene=1&srcid=0106CEFJ3wbtTM3djM3XPNMx&pass_ticket=8Z%2F%2BDDv0nAdAB4acb%2FuFISuY4pYxMPPbFAEYpRyDX9a6uAaJ0LzUyNcLT0Z%2B0E6O#rd
https://zning.me/14665923114477.html
感谢以上博客,有侵权的联系我。仅供学习用