当前位置:首页 » 编程软件 » centosnginx编译

centosnginx编译

发布时间: 2025-06-13 23:00:50

❶ centos系统编译安装nginx+php环境另加独立mysql教程

前端(nginx+php)ip:192.168.10.8
后端(独立mysql)ip:192.168.10.5
软件版本:libiconv-1.14.tar.gz mysql-5.1.63.tar.gz php-5.2.17.tar.gz php-5.2.17-fpm-0.5.14.diff.gz php-5.2.17-max-input-vars.patch
1.先在后端安装mysql
在192.168.10.5上只安装mysql.方法可以去看centos编译安装nginx+php-fpm+mysql里的mysql安装.
2.在前端安装php-fpm nginx和mysql-client
这里只说下安装mysql-client和php的编译安装.
                代码如下    tar zxf mysql-5.1.63.tar.gz cd mysql-5.1.63

./configure --prefix=/usr/local/mysql --without-server            
这里只需要加上--without-server就可以让mysql变成客户端了.
如果出现/bin/rm: cannot remove `libtoolt': No such file or directory,可以去看这篇文章Mysql安装:/bin/rm: cannot remove `libtoolt': No such file or directory.
没有问题后,执行命令:
                代码如下    make make install            
编译php的时候只需要加上--with-mysql=mysql客户端安装目录就可以了.这里我给出编译参数:
                代码如下    ./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-fpm-log=/var/log/php-fpm.log \

--with-fpm-conf=/etc/php-fpm.conf --with-fpm-pid=/var/run/php-fpm.pid --with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl \
--enable-ftp --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-gettext --with-mhash \
--enable-mbstring --with-mcrypt --enable-soap --enable-zip --with-iconv=/usr/local/libiconv \
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --without-pear            
nginx的编译没有什么好说的了,我前面centos编译安装nginx+php-fpm+mysql这篇文章里已经有讲过了.
3.进行测试验证
当上面的一切都安装好之后,在后端的mysql里给出远程权限,如下:
                代码如下    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';            
然后iptables上只允许192.168.10.8访问mysql端口,其他都拒绝.如:
                代码如下    iptables -A RH-Firewall-1-INPUT -s 192.168.10.8 -p tcp -m tcp --dport 3306 -j ACCEPT

iptables -A RH-Firewall-1-INPUT -p tcp --dport 3306 -j DROP
services iptables save
services iptables restart            
然后在192.168.10.8上进行测试,是否可以远程连上mysql
mysql -h 192.168.10.5 -u root -p
如果可以连上,就继续下一步的操作,不能连上的话请检查上面是否有错误的地方.
现在我们加个php页面来测试php是否可以连上mysql,脚本如下:
                代码如下    ?php

$link=mysql_connect("192.168.10.5","root","123456");
if(!$link) echo "bad!" ;
else echo "ok!" ;
mysql_close();
?            
成功的话是ok!的输出,失败的话是bad!的输出,我这里是成功的
mysql 5.5.x的只安装客户端.
需要的软件:libiconv-1.14.tar.gz mysql-5.5.25a.tar.gz
1.安装前的准备
安装前的准备,可以去看这篇文章centos编译安装nginx+php-fpm+mysql
2.安装libiconv
                代码如下    ./configure --prefix=/usr/local/libiconv

make make install            
3.只安装mysql客户端
                代码如下    cmake . make mysqlclient libmysql

make install            
这样就只安装了mysql客户端,然后可以输入whereis mysql来查看mysql安装位置.
whereis mysql
好了,可以看到跟yum安装的差不多.
4.安装php
以前mysql是5.1的时候,只需要加上--with-mysql=mysql客户端安装目录就可以了,但在mysql 5.5.x这个参数就要改变下了,下面是php的编译参数:
                代码如下    ./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-fpm-log=/var/log/php-fpm.log --with-fpm-conf=/etc/php-fpm.conf \

--with-fpm-pid=/var/run/php-fpm.pid --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d \
--with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-ftp \
--with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-gettext --with-mhash \
--enable-mbstring --with-mcrypt --enable-soap --enable-zip --with-iconv=/usr/local/libiconv \
--with-mysql=shared,/usr --with-mysqli=shared,/usr/bin/mysql_config            
大家可以看最后一行,--with-mysql=shared,/usr --with-mysqli=shared,/usr/bin/mysql_config这就是跟以前不同的行.好了,剩下的就不写了

❷ CentOS-5.8系统下nginx-1.2.2编译安装加上--with-http_image_filter_mole报错

系统提示:需要GD库
要么去掉这个参数,要么安装GD库

以下摘自网上帖子:
++++++++安装GD库的详细步骤++++++++++
NO1:安装JPEG包。
tar xzvf jpegsrc.v6b.tar.gz #解压
cd jpeg-6b
./configure #配置
make #编译
mkdir -p /usr/local/man/man1 #修复程序的一个小BUG
make install #安装
make install-lib
NO2: 安装TTF包
tar xzvf freetype-2.1.9.tar.gz
configure
make
make install
NO3:安装zlib包(libpng的支持包)
tar xzvf zlib-1.2.1.tar.gz
configure
make
make install
NO4: 安装libpng包
tar xzvf libpng-1.2.5.tar.gz
cp scripts/makefile.gcmnx makefile #这一步不需要配制,选择一个makefile
make
make install
NO5: 安装GD包
tar. xzvf gd-2.0.28.tar.gz
configure
make
make install
cp gd.h /usr/local/lib #将生成的头文件拷贝到lib目录下,否则会出错

❸ 求大神指导Centos7 源码编译安装Nginx+PHP 配置动静分离

这个是我的服务的实际 将配置Nginx实现动静分离,对php页面的请求转发给LAMP处理,而静态页面交给Nginx,以实现动静分离。客户请求静态数据给Nginx,Nginx直接应答客户端,当请求动态数据到Nginx时,Nginx让客户端去找LAMP,通过代理的方式,LAMP就和客户端连接了。分别配置动态分离和静态分离

(1)架设并调试后端LAMP架构,指定的域名,IP地址为xxxx,创建动态页面test.php。

(2)配置Nginx(xxxx)处理动态页面请求,并把域名改为 chaodiquan.com 在server{};段中加入以下代码,检测语法后,重启Nginx

(3)客户端输入xxxx/test.php 成功后动态分离就实现了,接下来再配置静态分离

(4)配置Nginx处理静态页面请求,在server{};中加入以下代码,检测语法后,重启Nginx

location ~ .*.(gif|jpg|jpeg|bmp|swf)$ { #这段代码意思是任意网址以这5种格式为结尾就到Nginx根目录下的html文件夹寻找资源

root html;
expires 1d; #缓存一天}

(5)在nginx的html目录中,放入图片aa.jpg,然后在apache的动态测试页test.php中添加

<html>
<body>
<img src="aaaa/aa.jpg">
</body>
</html>

(6)客户端输入xxxx/test.php测试,由于test.php是动态页面,因此客户端会找到LAMP架构中的Apache,然后调取图片aa.jpg是静态数据,所以从Nginx提取,最后反馈给客户端。这个是

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:593
制作脚本网站 发布:2025-10-20 08:17:34 浏览:887
python中的init方法 发布:2025-10-20 08:17:33 浏览:580
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:765
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:683
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:1012
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:254
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:112
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:803
python股票数据获取 发布:2025-10-20 07:39:44 浏览:712