aolishuai 2019-10-25
? L:linux
? N:nginx
? M:mysql
? P:php
Linux系统就没什么好说的了。这里是centos 7.6
yum -y install epel-release yum -y install nginx
yum -y install php php-fpm php-curl php-intl php-mcrypt php-mysql php-mbstring php-xml php-dom php-gd gd
(nginx + php-fpm +fastcgi)
vim /etv/nginx/nginx.conf
location ~\.php$ { root /webroot/farm; fastcgi_pass 127.0.0.1:9000; #与php-fpm通信的方式 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; 通信方式: nginx和php-fpm的通信方式有两种,一种是socket形式,一种是tcp形式。配置两种方式都可以,但是必须保证nginx配置的监听方式,和php-fpm.conf配置的监听方式保持一致性! 推荐使用TCP方式也就是方式1,可以跨服务器。 php配置:/etc/php-fpm.conf或者/etc/php-fpm.d/xx.conf 方式1: php-fpm.conf: listen = 127.0.0.1:9000 nginx.conf: fastcgi_pass 127.0.0.1:9000; 方式2: php-fpm.conf: listen = /tmp/php-fpm.sock nginx.conf: fastcgi_pass unix:/tmp/php-fpm.sock; 其中php-fpm.sock是一个文件,由php-fpm生成,类型是srw-rw----.
vim /etv/php.ini
#short_open_tag = off 改为如下: short_open_tag = on #打开短标签
上面配置完成就可以在nginx上部署php项目了。
[ ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm [ ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm [ ~]# vim /etc/yum.repos.d/mysql-community.repo [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/ enabled=1 将0改为1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql80-community] name=MySQL 8.0 Community Server baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/ enabled=0 将1改为0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [ ~]# yum -y install mysql-server mysql
启动&开机启动
[ ~]# systemctl start nginx [ ~]# systemctl start mysqld [ ~]# systemctl start php-fpm [ ~]# systemctl enable nginx [ ~]# systemctl enable mysqld [ ~]# systemctl enable php-fpm
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh