------------------------------ 安装包 ------------------------------
链接:https://pan.baidu.com/s/1hK_VoI6hgXEvdSUy4jm32g
提取码:ah7e
内容:php7.4.27、nginx1.20.2、mysql5.6.51
一些不必要的依赖文件,如果缺少可以来这里找找。
https://gitee.com/livekeys/linux-offline-installation-software.git
------------------------------ 网卡 ------------------------------
vi /etc/sysconfig/network-scripts/ifcfg-ens33
systemctl network restart
reboot
------------------------------ 解压缩 ------------------------------
tar zxvf FileName.tar.gz
unzip php7.4.27-\(rpm\).zip
tar xvf MySQL-5.6.51-1.el7.x86_64.rpm-bundle.tar
------------------------------ php ------------------------------
unzip php7.4.27-\(rpm\).zip
cd php7.4.27-\(rpm\)
rpm -Uvh *.rpm --nodeps --force
cd /usr/lib/systemd/system
systemctl start php74-php-fpm
ps aux|grep php-fpm
systemctl enable php74-php-fpm
/etc/opt/remi/php74
------------------------------ nginx ------------------------------
rpm -Uvh *.rpm --nodeps --force
systemctl start nginx
ps -ef |grep nginx
systemctl enable nginx
/etc/nginx
/usr/share/nginx/html
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl stop firewalld.service
systemctl start firewalld.service
firewall-cmd --reload
可能要用到
/etc/selinux/config
SELINUX=disabled
location ~ \.php$ { #root 路径配置必须要有,而且必须要写对(别笑,真的能写错)
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #SCRIPT_FILENAME用$document_root,而不是具体路径
include fastcgi_params;
}
------------------------------ mysql ------------------------------
tar xvf MySQL-5.6.51-1.el7.x86_64.rpm-bundle.tar
vi /root/.mysql_secret
nohup mysqld --user=root &
mysql -uroot -p
set password=password('Lysoo889900')
flush privileges
grant all privileges on *.* to 'root'@'%' identified by 'Lysoo889900' with grant option;
flush privileges
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
------------------------------ 配置ssl证书 ------------------------------
server{
listen 443 ssl;
#对应你的域名
server_name test.com;
ssl_certificate /usr/local/nginx/cert/ssl.crt;
ssl_certificate_key /usr/local/nginx/cert/ssl.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
#如果是静态文件,直接指向目录,如果是动态应用,用proxy_pass转发一下
location / {
root /usr/local/service/ROOT;
index index.html;
}
}
#监听80端口,并重定向到443
server{
listen 80;
server_name test.com;
rewrite ^/(.*)$ https://test.com:443/$1 permanent;
}
------------------------------ 伪静态 ------------------------------
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}