教程:CentOS 7 安装 LAMP

教程:CentOS 7 安装 LAMP

Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者主机的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE和.Net商业软件形成三足鼎立之势,并且该软件开发的项目在软件方面的投资成本较低,因此受到整个IT界的关注。从网站的流量上来说,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案.

1、清除、升级系统 yum clean all yum -y update hostname localhost systemctl stop firewalld systemctl disable firewalld

2、安装CSF cd /usr/src rm -fv csf.tgz wget https://download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf sh install.sh

3、配置CSF nano /etc/csf/csf.conf

输入 csf -r

保存,退出。

4、更改OpenSSH默认端口(也可不做更改) cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak nano /etc/ssh/sshd_config 找到Port 22,更改为其他端口,并在CSF中放行。

保存,推出。 重启服务: systemctl restart sshd.service

5、安装Apache

a、清除旧的服务: yum -y install httpd

b、设置域名目录(把example.com改为自己的域名) mkdir -p /var/www/example.com/public_html chown -R $USER:$USER /var/www/example.com/public_html chmod -R 755 /var/www mkdir /etc/httpd/sites-available mkdir /etc/httpd/sites-enabled

c、编辑配置文件 nano /etc/httpd/conf/httpd.conf 把 IncludeOptional sites-enabled/*.conf 放到文件底部

d、保存,退出。 nano /etc/httpd/sites-available/example.com.conf

e、把以下添加到网站配置文件(把example.com改为自己的域名) ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/example.com/public_html ErrorLog /var/www/example.com/error.log CustomLog /var/www/example.com/requests.log combined

f、保存,退出。 ln -s /etc/httpd/sites-available/example.com.conf /etc/httpd/sites-enabled/example.com.conf apachectl restart

6、安装CertBot (使用lets-encrypt创建ssl证书) yum install epel-release yum install certbot certbot certonly

下面是安装命令: certbot renew –dry-run certbot renew –quiet

7、安装PHP 5.6 yum -y update yum -y install epel-release wget https://dl.fedoraproject.org/pub/epe…t-7.noarch.rpm wget https://centos7.iuscommunity.org/ius-release.rpm rpm -Uvh ius-release*.rpm yum -y update yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath

8、安装MySQL yum -y install mariadb-server mariadb systemctl start mariadb mysql_secure_installation

9、安装phpMyAdmin yum -y install phpmyadmin nano /etc/httpd/conf.d/phpMyAdmin.conf 把127.0.0.1改为你的独立IP Alias /phpMyAdmin /usr/share/phpMyAdmin(把 /phpMyAdmin 改为 /usr/share/phpMyAdmin)

10、重启服务 systemctl restart httpd.service

via:http://www.webhostingtalk.com/showthread.php?t=1588551

推荐站内搜索:备案 查询、查ip地址、香港ip、免费ftp空间、域名注册服务、双线虚拟主机、永久免费的香港服务器、服务器怎么搭建、1g美国虚拟主机、电信服务器租赁、