热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Ubuntu系统安装配置Nginx和PHP服务器环境

编译安装PHP所需的支持库注:php在5.3.3以后的版本都已经集成了php-fpmtarzxvflibiconv-1.11.tar.gzcdlibiconv-1.11/./configure--prefix/usr/localmakemakeinstallcd../tarzxvffreetype-2.3.5.tar.
编译安装PHP 所需的支持库
注:php在5.3.3以后的版本都已经集成了php-fpm
tar zxvf libiconv-1.11.tar.gz
cd libiconv-1.11/
./configure --prefix=/usr/local
make
make install
cd ../
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5/
./configure
make
make install
cd ../
tar zxvf libpng-1.2.20.tar.gz
cd libpng-1.2.20/
./configure
make
make install
cd ../
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure
make
make install
make install-lib
cd ../
#----If your system was install libxml2, you do not need to install it.----
#tar zxvf libxml2-2.6.30.tar.gz
#cd libxml2-2.6.30/
#./configure
#make
#install
#cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
tar zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9/
./configure
make
make install
cd ../
cp /usr/local/lib/libmcrypt.* /usr/lib
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
tar zxvf mcrypt-2.6.6.tar.gz
cd mcrypt-2.6.6/
./configure
make
make install
cd ../
apt-get install libcurl4-gnutls-dev
apt-get install libjpeg-dev
apt-get install libpng-dev

配置,编译,安装 PHP
./configure --prefix=/usr/local/server/php --with-config-file-path=/usr/local/server/php/etc --with-mysql=/opt/mariadb/ --with-mysqli=/opt/mariadb/bin/mysql_config --with-iconv-dir=/usr/local --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex  --enable-fpm  --enable-mbstring --with-mcrypt --with-gd --with-freetype-dir --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear
ln -s /opt/mariadb/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
make && make install
安装 Nginx
nginx.org下载nginx源码包
./configure
apt-get install libpcre3-dev
make && make install

配置 nginx
       # 编辑nginx的配置文件nginx.conf
       vim /usr/local/nginx/conf/nginx.conf
       root   "/home/bob/php/workspace/";      #指定PHP文件目录
       index index.html index.htm index.php;
       # location / {
       #     root   html;
       #     index  index.html index.htm;
       # }
       location ~ .*\.(php|php5)?$
           {
                 #fastcgi_pass  unix:/tmp/php-cgi.sock;
                  fastcgi_pass  127.0.0.1:9000;
                  fastcgi_index index.php;
                  include fastcgi.conf;
           }

配置 PHP fast cgi模式
cp /usr/local/server/php/etc php-fpm.conf.default php-fpm.conf

start nginx
./usr/local/nginx/sbin/nginx

start php
./usr/local/server/php/sbin/php-fpm

验证PHP和Nginx是否正确启动
# netstat -ntlp
激活Internet连接 (仅服务器)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      6624/nginx
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1485/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5048/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1236/cupsd
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      6689/php-fpm.conf)
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      10960/mysqld
tcp6       0      0 :::22                   :::*                    LISTEN      5048/sshd
tcp6       0      0 ::1:631                 :::*                    LISTEN      1236/cupsd
在 /home/bob/php/workspace/ 路径下创建一个index.php,内容如下:

echo "PHP fast cgi finished!"
?>
在本机浏览器上输入:http://localhost
浏览器将显示 PHP fast cgi finished!

推荐阅读
  • 如何部署Zabbix监控实现监测和报警机制
    这篇文章的知识点包括:Zabbix的安装部署、Zabbix监控的实现以及Zabbix报警机制的实现,阅读完整文相信大家对Zabbix监控的使用有了一定的认识。Zabb ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文介绍了在SpringBoot中集成thymeleaf前端模版的配置步骤,包括在application.properties配置文件中添加thymeleaf的配置信息,引入thymeleaf的jar包,以及创建PageController并添加index方法。 ... [详细]
  • 本文介绍了使用cacti监控mssql 2005运行资源情况的操作步骤,包括安装必要的工具和驱动,测试mssql的连接,配置监控脚本等。通过php连接mssql来获取SQL 2005性能计算器的值,实现对mssql的监控。详细的操作步骤和代码请参考附件。 ... [详细]
  • Linux下部署Symfoy2对app/cache和app/logs目录的权限设置,symfoy2logs
    php教程|php手册xml文件php教程-php手册Linux下部署Symfoy2对appcache和applogs目录的权限设置,symfoy2logs黑色记事本源码,vsco ... [详细]
  • Linux一键安装web环境全攻略
    摘自阿里云服务器官网,此处一键安装包下载:点此下载安装须知1、此安装包可在阿里云所有Linux系统上部署安装,此安装包包含的软件及版本为& ... [详细]
  • 构建LNMP架构平台
    LNMP架构的组成:Linux、Nginx、MySQL、PHP关于NginxNginx与apache的作用一样,都是为了搭建网站服务器,由俄罗斯人lgorsysoev开发,其特点是 ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • LVS实现负载均衡的原理LVS负载均衡负载均衡集群是LoadBalance集群。是一种将网络上的访问流量分布于各个节点,以降低服务器压力,更好的向客户端 ... [详细]
  • 本文介绍了在无法联网的情况下,通过下载rpm包离线安装zip和unzip的方法。详细介绍了如何搜索并下载合适的rpm包,以及如何使用rpm命令进行安装。 ... [详细]
  • 负载均衡_Nginx反向代理动静分离负载均衡及rewrite隐藏路径详解(Nginx Apache MySQL Redis)–第二部分
    nginx反向代理、动静分离、负载均衡及rewrite隐藏路径详解 ... [详细]
  • nginx+多个tomcat
    学习nginx的时候遇到的问题:nginx怎么部署两台tomcat?upstream在网上找的资源,我在nginx配置文件(nginx.conf)中添加了两个server。结果只显 ... [详细]
  • MySQL/MariaDB/PerconaDB提权条件漏洞
    背景  2016年11月01日,国外安全研究员DawidGolunski在MyS ... [详细]
  • 本文是搭建的mariadb-10.0.17版本的下载地址:https:downloads.mariadb.orginterstitialmariadb-10.0.17sourcemariadb-10.0.17.tar.gzfromhtt ... [详细]
author-avatar
甜心菇
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有