更新yum
yum update
安装yum-utils
yum install yum-utils
1、安装nginx
获取比较新的nginx的yum源数据
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装nginx
yum install nginx
启动nginx
service nginx start
设置nginx服务器开机自启动
systemctl enable nginx.service
检查开机自动是否设置成功
systemctl list-dependencies | grep nginx
2、安装PHP7.4
安装 EPEL 源及源管理工具:
yum install epel-release yum-utils
安装 REMI 源:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装PHP
yum install -y php74-php-fpm php74-php-cli php74-php-gd php74-php-json php74-php-mbstring php74-php-mysqlnd php74-php-xml
php73 -v
#查看版本
systemctl enable php74-php-fpm
#开启开机自启
systemctl start php74-php-fpm
#启动
systemctl restart php74-php-fpm
#重启
systemctl stop php74-php-fpm
#关闭
systemctl status php74-php-fpm
#检查状态
3、集成NGIN+PHP
vi /etc/nginx/conf.d/default.conf
server { server_name domain.com www.domain.com; location / { root /www/htdocs; index index.php index.html index.htm; } location ~ \.php$ { root /www/htdocs; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } listen 443 ssl; ssl_certificate /etc/nginx/certs/domain.com/cert.pem; ssl_certificate_key /etc/nginx/certs/domain.com/key.pem; } server { if ($host = www.domain.com) { return 301 https://$host$request_uri; } listen 80; server_name domain.com www.domain.com; return 404; }
4、安装mysql8.0
在MySQL官网中获取YUM源rpm包地址
https://dev.mysql.com/downloads/repo/yum/
更新YUM源
wget https://dev.mysql.com/get/mysql80-community-release-el7-4.noarch.rpm
yum localinstall mysql80-community-release-el7-4.noarch.rpm
yum clean all
yum makecache
安装mysql
yum install mysql-community-server
编辑配置
vi /etc/my.cnf
启动mysql
service mysqld start
查看初始登录密码
cat /var/log/mysqld.log | grep password
登录
mysql -uroot -p
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_PASSWORD';
FLUSH PRIVILEGES;
设置自动启动
systemctl enable mysqld
参考:
https://www.cnblogs.com/jinpingzhao/p/12695435.html
https://blog.csdn.net/chipiaobai6529/article/details/100934021
https://www.cnblogs.com/skyblue123/p/13287028.html