本机环境:服务器是阿里云ECS;使用的镜像是:公共镜像 CENTOS 7.2
一.nginx安装
1.下载对应当前系统版本的nginx包(package)
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2.建立nginx的yum仓库(默认yum是没有nginx的)
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
3.下载并安装nginx
yum install nginx
4.nginx启动(nginx安装目录下-/usr/sbin/)
systemctl start nginx.service
ps:一些其它nginx相关命令:
nginx相关配置文件:
默认的配置文件在 /etc/nginx 路径下,使用该配置已经可以正确地运行nginx;
如需要自定义,修改其下的 nginx.conf 等文件即可;
在浏览器地址栏中输入部署nginx环境的机器的IP,如果一切正常,应该能看到如下字样的内容。
Welcome to nginx!
If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.
For online documentation and support please refer tonginx.org.Commercial support is available atnginx.com.
Thank you for using nginx.
第二步:MYSQL安装
1.先下载mysql的repo源;相关命令:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2.安装mysql-community-release-el7-5.noarch.rpm包
(安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo)
rpm -ivh mysql-community-release-el7-5.noarch.rpm
3.安装MYSQL
sudo yum install mysql-server
4.重置密码
更改用户权限:
sudo chown -R root:root /var/lib/mysql
重启服务:
systemctl restart mysql.service
登录,并修改密码:
mysql -u root mysql > use mysql; mysql > update user set password=password(‘123456‘) where user=‘root‘; mysql > exit;
第三步:安装php
1.查看当前安装的php版本( yum list installed | grep php)
如果存在php安装包先删除之前版本 用yum remove 移除 php相关的包
2.rpm 安装 Php7 相应的 yum源
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3.安装php7.0
yum install php70w
4.安装php扩展
php70w-mysql.x8664
新闻热点
疑难解答