centos7下yum安装nginx+apache+mysql

  • 2016-03-02 15:40:50
  • 运维
  • 24
  • shevechco

 下载对应当前系统版本的nginx包(package)

01.
wget  http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

建立nginx的yum仓库

01.
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

下载并安装nginx

01.
yum install nginx

启动nginx服务

01.
systemctl start nginx.service #启动nginx
02.
systemctl enable nginx.service #加入到开机启动

默认的配置文件在 /etc/nginx 路径下,使用该配置已经可以正确地运行nginx;如需要自定义,修改其下的 nginx.conf 等文件即可。

安装mariadb

01.
yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成
02.
systemctl start mariadb.service #启动MariaDB
03.
systemctl stop mariadb.service #停止MariaDB
04.
systemctl restart mariadb.service #重启MariaDB
05.
systemctl enable mariadb.service #设置开机启动
06.
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)

安装apache及其扩展

01.
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
02.
systemctl start httpd.service #启动apache
03.
systemctl stop httpd.service #停止apache
04.
systemctl restart httpd.service #重启apache
05.
systemctl enable httpd.service #设置开机启动

安装php及其扩展

01.
yum -y install php php-cli php-curl php-intl php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-mysql php-odbc php-mbstring php-devel

nginx配置文件在/etc/nginx/nginx.conf

apache配置文件在/etc/httpd/conf/httpd.conf


内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.sulao.cn/post/190

相关推荐