目录

一、nginx的安装

二、php的下载安装

1.进入到/usr/local/下,下载php的安装包(php的下载网址)

2.解压

3.进入到php-7.4.6下,安装需要的依赖包


这个我在前面写过,具体请看:

nginx的下载和配置链接

cd /usr/local/

wget https://www.php.net/distributions/php-7.4.6.tar.gz

tar -zxvf php-7.4.6.tar.gz

cd php-7.4.6

yum instally libxml2 libxml2-devel openssldevel  curldevel libjpegdevel libpngdevel freetypedevel libzipdevel  onigurumadevel  sqlitedevel

./configure  —prefix=/usr/local/php74 —withconfigfilepath=/etc/php74 —withfpmuser=nginxwithfpmgroup=nginxenablefpmenableopcacheenableinlineoptimizationdisabledebugdisablerpathenablesharedenablemysqlndwithmysqli=mysqlnd –withpdomysql=mysqlndenablemysqlndcompressionsupport –withiconv-dir –with-zlibenablexmldisablerpathenablebcmathenableshmopenablesysvsemenableinlineoptimization –with-curlenablembregex –enable-mbstring –enable-intl –enable-ftp –enable-gd –enable-gd-jisconv –with-jpeg   –with-freetype  –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –with-zip –enable-soap –with-gettext –enable-fileinfo –with-pear –enable-maintainer-zts –with-ldap=shared –without-gdbm –with-zip

make && make install

vim /etc/profile
PATH=$PATH:/usr/local/php74/bin    #我这里目录是php74注意别写错
source /etc/profile
# 此时执行
php -v   #即可看到php信息

cp /usr/local/php-7.4.16/php.iniproduction /usr/local/php74/php.ini

vim /usr/local/php74/php.ini
display_errors = On   //原来是off

cd /usr/local/php74/etc
cp php-fpm.conf.default php-fpm.conf
vim php.fpm.conf
去掉pid=run/php-fpm.pid前面的分号
cd ./php-fpm.d
cp www.conf.default www.conf

cd /usr/local/php74/sbin/

./php-fpm

cd /usr/local/php-7.4.16/sapi/fpm
cp init.d.php-fpm /etc/init.d/php-fpm
#赋予脚本执行命令添加开机自启动
chmod +x /etc/init.d/php-fpm
chkconfigadd php-fpm
chkconfig php-fpm on

systemctl restart php-fpm.service

systemctl status php-fpm.service

vim /usr/local/nginx/nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  ‘$remote_addr – $remote_user [$time_local] “$request” ‘
                      ‘$status $body_bytes_sent “$http_referer” ‘
                      ‘”$http_user_agent” “$http_x_forwarded_for”‘;

    access_log  logs/access.log  main;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;

         }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ .php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;                          include        fastcgi_params;
        }

    }

server {
        listen       80;
        server_name  www.php.com;

        location / {
            root   /usr/local/nginx/html/php;
            index  index.html index.htm index.php;
        }
        location ~ .php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;            include        fastcgi_params;
        }

    }

  # ip 100
    server {
       listen 80;
       server_name 192.168.191.100;
       location / {
            root /usr/local/nginx/html/ip/100;
           index index.html;
        }
    }

  # ip 200
    server {
       listen 80;
       server_name 192.168.191.200;
       location / {
            root /usr/local/nginx/html/ip/200;
           index index.html;
        }
    }

  # port 100
    server {
       listen 100;
       server_name 192.168.191.129;
       location / {
            root /usr/local/nginx/html/port/100;
            index index.html;
        }
    }
  # port 200
    server {
       listen 200;
       server_name 192.168.191.129;
       location / {
            root /usr/local/nginx/html/port/200;
            index index.html;
        }
    }
   # www.jiege.com
    server {
       listen 80;
       server_name www.jiege.com;
       location / {
            root /usr/local/nginx/html/name/jiege;
            index index.html;
        }
    }

}

cd /usr/local/nginx/html/php/

vim index.php

<?php

phpinfo();

?&gt;

vim /etc/hosts

192.168.191.129  www.php.com

C:WindowsSystem32driversetc

192.168.191.129  www.php.com

cd /usr/local/nginx/sbin/

./nginx

cd /usr/local/php/sbin/

./php-fpm

killall php-fpm

rpm -qa|grep php

wget http://dev.mysql.com/get/mysql57-communityrelease-el7-8.noarch.rpm

yum localinstall mysql57-communityrelease-el7-8.noarch.rpm

yum repolist enabled | grepmysql.*-community.*”

yum module disable mysql

yum install mysql-community-server —nogpgcheck 

systemctl restart mysqld.service

systemctl restart mysqld.service 

vim   /etc/my.cnf

[mysqld]

skipgranttables

systemctl restart mysqld

mysql -uroot -p

use mysql

update user set password=password(‘root’) where user=’root’;

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’IDENTIFIED BY ‘root’ WITH GRANT OPTION;

flush privileges;

exit

# skipgranttables

systemctl restart mysqld.service

mysql -uroot –proot

        别问我怎么做出来的,两天时间,边排错边配置,头大,你们自己看着自己弄吧,由于配置时候经常有些问题,不过我都给你们解决了,所以我就不粘图片了,你们自己加油。按照我的走绝对没问题

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注