1、安装yum
yum update
2、安装Nginx源:
yum localinstall http://Nginx.org/packages/centos/7/noarch/RPMS/Nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "Nginx*"
安装Nginx
yum -y install Nginx
启动Nginx
设置开机自启动
systemctl enable Nginx.service
3、检查开机自启动是否设置成功
systemctl list-dependencies | grep Nginx
4、浏览器中输入公网ip,检测是否安装成功
出现如下则成功
5、安装MysqL
安装MysqL源
yum -y localinstall http://dev.MysqL.com/get/MysqL57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "MysqL.*-community.*"
安装MysqL
yum -y install MysqL-community-server install MysqL-community-devel
启动MysqL
systemctl MysqLd start
检查MysqL启动是否正常
sytemctl MysqLd status 或者 ps -ef | grep MysqL
设置MysqLd服务开机自启动
systemctl enable MysqLd.service
检查MysqLd开机自启动是否设置成功
systemctl list-dependencies | grep MysqLd
MysqL5.7以后的争强了安全机制, 所以使用yum安装,启动会系统会自动生成一个随机的密码,修改MysqL密码
查看MysqL的随机密码
grep 'temporary password' /var/log/MysqLd.log
MysqL -u root -p 更改密码(MysqL文档规定,密码必须包括大小写字母数字加特殊符号>8位) 根据获取的随机密码登录
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';修改密码
退出MysqL客户端,用刚才修改的密码登录确保密码修改成功 exit;
6、安装PHP
安装PHP源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装PHP扩展源(这是PHP7.1的安装其他版本直接把7.1直接改成7.2)
yum repolist enabled | grep "webtatic*"
yum -y install PHP71w PHP71w-fpm
yum -y install PHP71w-mbstring PHP71w-common PHP71w-gd PHP71w-mcrypt
yum -y install PHP71w-MysqL PHP71w-xml PHP71w-cli PHP71w-devel
yum -y install PHP71w-pecl-memcached PHP71w-pecl-redis PHP71w-opcache
验证PHP7.1.x和扩展是否安装成功
新建.conf后缀的文件文件目录在/etc/Nginx/conf.d/下面 复制下面内容放进去
server {
listen 80;
server_name danshufenxiang.com;
root /home/www; #自定义站点位置
index index.PHP index.html index.htm;
location / {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/Nginx/html;
}
location ~ \.PHP$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。