apache

安装Apache

  • 安装apache
yum -y install httpd
  • 配置Apache 编辑/etc/httpd/conf/httpd.conf,在文件末尾加入
Include vhost-conf.d/*.conf

然后创建相应的目录与文件

mkdir /etc/httpd/vhost-conf.d
vi awei.8800.org.10086.conf  #此为网站的配置文件

内容如下,因为80端口被封,改个10086端口出去:

Listen 10086
<VirtualHost *:10086>
ServerAdmin awei@localhost
ServerName awei.8800.org
DocumentRoot /home/www/html/wordpress
<Directory /home/www/html/wordpress>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/www/awei.8800.org/log/error.log
CustomLog /var/log/www/awei.8800.org/log/access.log combined
</VirtualHost>
  • 防火墙设置

防火墙,开放httpd服务和10086端口

    firewall-cmd --permanent --zone=public --add-service=http

    firewall-cmd --permanent --zone=public --add-port=10086/tcp
  • Selinux配置
semanage port -a -t http_port_t -p tcp 10086

semanage的安装

yum -y install policycoreutils-python
  • 设置开机启动
systemctl enable httpd
systemctl restart httpd

安装mariadb

  • 安装mariadb
yum install mariadb mariadb-server
  • 配置
mysql_secure_installation

按提示操作

添加数据库并授权给相应用户

grant all on wordpress.* to newdbuser identified by dbuserpassword;
  • 设置开机启动
systemctl enable mariadb
systemctl restart mariadb

安装PHP

  • 安装php
yum install php php-mysqlnd

php配置不多说了。

结束语

记得对每个服务都要授权自动启动,然后就是各种折腾了……^_^ lamp

Related content