社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  NGINX

shell一键源码安装nginx+php

人生匆匆 • 4 年前 • 346 次点击  
vim nginx_php.sh
  • 1
#!/bin/bash
systemctl stop firewalld
setenforce 0
wget http://nginx.org/download/nginx-1.16.1.tar.gz
if [ $? -ne 0 ];then
        echo "下载nginx.tar包出问题"
        exit
fi
yum -y install gcc gcc-c++ zlib-devel pcre-devel php php-fpm php-mysql php-gd
tar zxf nginx-1.16.1.tar.gz
cd nginx-1.16.1 && ./configure && make && make install
sed -i  's/index  index.html/index  index.php index.html/g' /usr/local/nginx/conf/nginx.conf
sed -i  '/#location ~ \.php\$ {/include        fastcgi_params;/d' /usr/local/nginx/conf/nginx.conf
sed -i '/\#location \~ \\.php\$ {/,/fastcgi_params;/d' /usr/local/nginx/conf/nginx.conf
sed -i '/proxy the PHP/alocation \~ \\.php$ {\nroot           html;\nfastcgi_pass   127.0.0.1:9000;\nfastcgi_index  index.php;\nfastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\ninclude        fastcgi_params;\n}' /usr/local/nginx/conf/nginx.conf
echo '<?php phpinfo(); ?>'>/usr/local/nginx/html/index.php
systemctl restart php-fpm
/usr/local/nginx/sbin/nginx
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
sh nginx_php.sh
  • 1

测试:
在这里插入图片描述

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/52323
 
346 次点击