下载对应当前系统版本的nginx包(package)
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
建立nginx的yum仓库
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
下载并安装nginx
yum install nginx
启动nginx服务
systemctl start nginx.service #启动nginx systemctl enable nginx.service #加入到开机启动
默认的配置文件在 /etc/nginx 路径下,使用该配置已经可以正确地运行nginx;如需要自定义,修改其下的 nginx.conf 等文件即可。
安装mariadb
yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成 systemctl start mariadb.service #启动MariaDB systemctl stop mariadb.service #停止MariaDB systemctl restart mariadb.service #重启MariaDB systemctl enable mariadb.service #设置开机启动 cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
安装apache及其扩展
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql systemctl start httpd.service #启动apache systemctl stop httpd.service #停止apache systemctl restart httpd.service #重启apache systemctl enable httpd.service #设置开机启动
安装php及其扩展
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