Linux/Unix下nginx php安装简明教程
一、安装nginx: 1. 安装pcre库,nginx的rewrite模板需用到pcre库: 1. mkdir -p /works 2. cd /works 3. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz 4. tar -zxvf pcre-8.20.tar.gz 5. ./configure 6. make make install 7
一、安装nginx:
1. 安装pcre库,nginx的rewrite模板需用到pcre库:
1. mkdir -p /works
2. cd /works
3. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
4. tar -zxvf pcre-8.20.tar.gz
5. ./configure
6. make && make install
7. cd ..
2. 安装nginx: www.2cto.com
1. wget http://nginx.org/download/nginx-1.0.10.tar.gz
2. tar -zxvf nginx-1.0.10.tar.gz
3. cd nginx-1.0.10
4. ./configure
5. make && make install
6. cd ..
3. 新建用户和组:
1. groupadd www
2. useradd -r -g www www
二、安装PHP5
1. 安装依赖包:
1. libcurl:
2. wget http://curl.haxx.se/download/curl-7.23.1.tar.gz
3. tar -zxvf curl-7.23.1.tar.gz
4. cd curl-7.23.1/
5. ./configure
6. make && make install
7. cd ..
libxml2:
1. wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
2. tar -zxvf libxml2-2.7.6.tar.gz
3. cd libxml2-2.7.6
4. ./configure
5. make && make install
6. cd ..
libxslt:
1. wget ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
2. tar -zxvf libxslt-1.1.24.tar.gz
3. cd libxslt-1.1.24
4. ./configure make && make install
5. cd ..
freetype:
1. wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.gz
2. tar -zxvf freetype-2.4.6.tar.gz
3. cd freetype-2.4.6 ./configure
4. make && make install
5. cd ..
libpng:
1. wget "http://prdownloads.sourceforge.net/libpng/libpng-1.5.6.tar.gz?download"
2. tar -zxvf libpng-1.5.6.tar.gz
3. cd libpng-1.5.6 ./configure
4. make && make install
5. cd ..
libjpeg:
1. wget http://ijg.org/files/jpegsrc.v8c.tar.gz
2. tar -zxvf jpegsrc.v8c.tar.gz
3. cd jpeg-8c/
4. ./configure
5. make && make install
6. cd ..
2. 安装php5和php-fpm:
1. wget http://museum.php.net/php5/php-5.2.16.tar.gz
2. wget http://php-fpm.org/downloads/php-5.2.16-fpm-0.5.14.diff.gz
3. tar -zxvf php-5.2.16.tar.gz
4. gunzip php-5.2.16-fpm-0.5.14.diff.gz
5. cd php-5.2.16/
6. patch -p1 < ../php-5.2.16-fpm-0.5.14.diff
7.
8. ./configure
9. --with-curl
10. --enable-calendar
11. --with-xsl
12. --with-libxml-dir
13. --enable-ftp
14. --with-gd
15. --with-freetype-dir
16. --with-jpeg-dir
17. --with-png-dir
18. --enable-mbstring
19. --with-zlib
20. --enable-shared
21. --with-mysql
22. --enable-fastcgi
23. --enable-fpm
24. ./configure && make && make install
修改php-fpm的配置文件/usr/local/etc/php-fpm.conf,设置执行php-fpm的用户和组名:
大约在第62行:
1. Unix user of processes
2.
3. Unix group of processes
4.
修改为:
1. Unix user of processes
2.
3. Unix group of processes
4.
启动php-fpm:
1. /usr/local/sbin/php-fpm start
2. lsof -i:9000
3. netstat -ant|grep 9000
4. #9000为php-fpm的默认端口,可以在/usr/local/etc/php-fpm.conf中修改。
修改nginx配置文件/usr/local/nginx/conf/nginx.conf,我的nginx配置文件如下:
1. worker_processes 10;
2. events {
3. worker_connections 1024;
4. }
5. http {
6. include mime.types;
7. default_type application/octet-stream;
8. sendfile on;
9. keepalive_timeout 65;
10. gzip on;
11. server {
12. listen 80;
13. server_name ead;
14. root /data/faceshow/www;
15. location / {
16. root html;
17. index index.php index.html index.htm;
18. }
19. error_page 500 502 503 504 /50x.html;
20. location = /50x.html {
21. root html;
22. }
23.
24. #此段代码为关键
25. location ~ .php$ {
26. fastcgi_pass 127.0.0.1:9000; #对应php-fmp的端口
27. fastcgi_index index.php;
28. fastcgi_param SCRIPT_FILENAME /data/faceshow/www/$fastcgi_script_name;
29. #php文件的物理路径
30. include fastcgi_params;
31. }
32.
33. location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
34. {
35. expires 30d;
36. }
37. location ~ .*.(js|css)?$
38. {
39. expires 1h;
40. }
41. }
42. }
43.
启动nginx:
1. /usr/local/nginx/bin/nginx
2. /usr/local/nginx/bin/nginx -s reload
三、常见问题:
问题:nginx ./configure时报如下错误
1. ./configure: error: the HTTP rewrite module requires the PCRE library.
2. You can either disable the module by using --without-http_rewrite_module
3. option, or install the PCRE library into the system, or build the PCRE library
4. statically from the source with nginx by using --with-pcre=
解决:这是由于未PCRE库,请安装PCRE库在运行./configure。也可以使用带--without-http_rewrite_module参数进行./configure,但是这将导致nginx不支持rewrite功能!
四、相关文件下载地址:
libcurl: http://curl.haxx.se/download.html
libxml2:ftp://xmlsoft.org/libxml2/
libxslt:ftp://xmlsoft.org/libxml2/
libpng:http://www.libpng.org/pub/png/libpng.html
libjpeg: http://ijg.org/files/
freetype:http://download.savannah.gnu.org/releases/freetype/
pcre:http://www.pcre.org/
nginx:http://nginx.org/en/download.html
php-fpm:http://php-fpm.org/
php5:http://www.php.net/releases/
MySQL:http://www.mysql.com/downloads/mirror.php?id=404683#mirrors
摘自 爱E族

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

对于许多用户来说,破解 Android 电视盒听起来令人畏惧。然而,在 Broadcom 芯片短缺期间,开发人员 Murray R. Van Luyn 面临着寻找 Raspberry Pi 合适替代品的挑战。他与 Armbia 的合作努力

DeepSeek 是一款强大的智能搜索与分析工具,提供网页版和官网两种访问方式。网页版便捷高效,免安装即可使用;官网则提供全面产品信息、下载资源和支持服务。无论个人还是企业用户,都可以通过 DeepSeek 轻松获取和分析海量数据,提升工作效率、辅助决策和促进创新。

DeepSeek的安装方法有多种,包括:从源码编译(适用于经验丰富的开发者)使用预编译包(适用于Windows用户)使用Docker容器(最便捷,无需担心兼容性)无论选择哪种方法,请仔细阅读官方文档并充分准备,避免不必要的麻烦。

如何下载BitPie比特派钱包App?步骤如下:在AppStore(苹果设备)或GooglePlay商店(安卓设备)中搜索“BitPie比特派钱包”。点击“获取”或“安装”按钮下载应用程序。对于电脑版,访问BitPie比特派钱包官方网站并下载相应软件包。

BITGet 是一款加密货币交易所,提供各种交易服务,包括现货交易、合约交易和衍生品。该交易所成立于 2018 年,总部位于新加坡,致力于为用户提供安全可靠的交易平台。BITGet 提供多种交易对,包括 BTC/USDT、ETH/USDT 和 XRP/USDT。此外,该交易所还在安全性和流动性方面享有盛誉,并提供多种功能,如高级订单类型、杠杆交易和 24/7 全天候客户支持。

系统变量$n传递给脚本或函数的参数。n是一个数字,表示第几个参数。例如,第一个参数是$1,第二个参数是$2$?上个命令的退出状态,或函数的返回值。成功返回0,失败返回1$#传递给脚本或函数的参数个数$*所有这些参数都被双引号引住。若一个脚本接收两个参数,$*等于$1$2$0正在被执行命令的名字。对于shell脚本而言,这是被激活命令的路径$@被双引号(”“)包含时,与$*稍有不同。若一个脚本接收到两个参数,$@等价于$1$2$$当前shell的进程号。对于shell脚本,这是其正在执行时的进程I

1.安装环境(Hyper-V虚拟机):$hostnamectlStatichostname:localhost.localdomainIconname:computer-vmChassis:vmMachineID:renwoles1d8743989a40cb81db696400BootID:renwoles272f4aa59935dcdd0d456501Virtualization:microsoftOperatingSystem:CentOSLinux7(Core)CPEOSName:cpe:

欧易 OKX,全球领先的数字资产交易所,现推出官方安装包,提供安全便捷的交易体验。欧易 OKX 安装包无需通过浏览器访问,可直接在设备上安装独立应用程序,为用户打造稳定高效的交易平台。安装过程简便易懂,用户只需下载最新版本安装包,按照提示一步步操作即可完成安装。
