1.安装libxml2

./configure --prefix=/usr/local/libxml2
make
make install

失败的话执行 make clean,再重复上述操作

2.安装php

-下载php ...

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/libxml2
make
make install

也可以使用yum安装软件包:

yum list | grep xxx

yum install -y libpng-devel libjpeg-devel freetype-devel libmcrypt-devel ...

./configure --prefix=/usr/local/php5.6 --with-config-file-path=/usr/local/php5.6/etc --enable-fpm --with-libxml-dir=/usr/local/libxml2 --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gd --with-mcrypt --enable-soap --enable-mbstring=all --enable-sockets  --with-mysqli=mysqlnd  --with-pdo-mysql --enable-mysqlnd --with-zlib-dir=/usr/local/zlib --disable-fileinfo
#测试php-fpm配置
/usr/local/php/sbin/php-fpm -t
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf -t #启动php-fpm
/usr/local/php/sbin/php-fpm
/usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini -y /usr/local/php/etc/php-fpm.conf #关闭php-fpm
kill -INT `cat /usr/local/php/var/run/php-fpm.pid` #重启php-fpm
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

3.安装Nginx

Nginx需要依赖下面3个包

  1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ ) zlib-1.2.8.tar.gz
  2. rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ ) pcre-8.21.tar.gz
  3. ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ ) openssl-1.0.1.tar.gz

安装zlib

wget http://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
./configure --prefix=/usr/local/zlib
make && make install

安装pcre

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
./configure --prefix=/usr/local/pcre
make && make install

安装openssl

wget http://www.openssl.org/source/openssl-1.0.2e.tar.gz
./config --prefix=/usr/local/openssl
make && make install

创建用户

  1. groupadd -r nginx
\#创建系统工作组,系统工作组的组ID小于500
  1. useradd -r -g nginx -s /bin/false -M nginx
\#-r 建立系统帐号
\#-g<群组> 指定用户所属的群组
\#-s<shell> 指定用户登入后所使用的shell,"/bin/false"su不到该用户
\#-M 不自动建立用户的登入目录

下载nginx

wget http://nginx.org/download/nginx-1.9.9.tar.gz

./configure --sbin-path=/usr/local/nginx/ --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/home/install/pcre-8.38 --with-zlib=/home/install/zlib-1.2.8 --with-openssl=/home/install/openssl-1.0.2e --with-http_stub_status_module --user=nginx --group=nginx

--with-zlib 和 --with-openssl --with-openssl #指向解压的源码目录

--with-http_stub_status_module #启用nginx的NginxStatus功能,用来监控Nginx的当前状态:

在nginx.conf的server块中添加如下代码
location /nginx_status {
# Turn on nginx stats
stub_status on;
# I do not need logs for stats
access_log off;
# Security: Only allow access from 192.168.1.100 IP #
#allow 192.168.1.100;
# Send rest of the world to /dev/null #
#deny all;
}
    这段代码是加在默认的server里的,
假设默认server的配置为 listen 127.0.0.1:80;
server_name 127.0.0.1;
那么访问nginx的状态,就可以通过 curl 127.0.0.1/nginx_status访问了 返回结果类似于: Active connections: 1
server accepts handled requests
655 655 1985
Reading: 0 Writing: 1 Waiting: 0

linux安装php & nginx的更多相关文章

  1. linux安装部署Nginx

    两个参考地址: NGINX的百度百科:https://baike.baidu.com/item/nginx/3817705?fr=aladdin NGINX的中文网站:http://www.nginx ...

  2. Linux安装配置Nginx

    之所以搭建Nginx,是因为要做一个图片服务器,之前已经搭建好了Ftp,要想实现通过网页的src标签显示图片需要,搭建web服务器(虽然也可以通过在img标签中的src属性里面写“ ftp://用户名 ...

  3. linux 安装命令 nginx 部署

    [TOC] # 安装anocanda wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh安装:bash A ...

  4. linux 安装配置Nginx

    简介: Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,供俄国 ...

  5. linux 安装php7 Nginx

    这里 记录下 本屌安装linux  下安装php7 即遇到的问题. wget http://cn2.php.NET/distributions/php-7.0.4.tar.gz tar zxvf ph ...

  6. linux安装php nginx mysql

    linux装软件方式: systemctl status firewalld.service 查看防火墙systemctl stop firewalld.service systemctl disab ...

  7. Linux安装FastDFS~Nginx~

    确保Linux联网,我这里使用的是CentOS7操作,联网教程 https://www.cnblogs.com/taopanfeng/p/10978752.html 先把指定的四个文件放入指定目录 安 ...

  8. Linux 安装配置 Nginx

    前言 准备用flask做一个自己的博客网站,打算用Nginx来部署,所以在阿里云的服务器上安装Nginx,参考了很多教程,现在将步骤以及自己遇到的坑写下来,希望能对别人有所帮助. 我用的服务器是阿里云 ...

  9. Linux安装配置Nginx服务器

    如有需要可以加我Q群[308742428]大家一起讨论技术,有偿服务. 后面会不定时为大家更新文章,敬请期待. 喜欢的朋友可以关注下. 前言 今天搭建nginx服务器,来访问静态资源文件. Nginx ...

随机推荐

  1. Fiery Youth

    青春和时间是一对好兄弟,让人留恋的时光总是那么快偷偷溜走了.学习java不能确定改变生活和现状,至少是迈出了进步的决定,而不是停滞不前.既然这样,那就动起来吧!看了刘树勇老师的演讲,就得出一个结论:千 ...

  2. iOS 2D绘图 (Quartz2D)之路径(stroke,fill,clip,subpath,blend)

    像往常一样 这个系列的博客是跟着大神的脚步来的.按照往例 在此贴出原博客的出处: http://blog.csdn.net/hello_hwc?viewmode=list我对大神的崇拜之情 如滔滔江水 ...

  3. Centos6 服务器病毒查杀命令历史

    top whereis vhowazeclu ll /usr/bin/v* more /usr/bin/vhowazeclu ps aux|grep vhowa ps aux|grep vhowaze ...

  4. C# 读取EXCEL文件的三种经典方法

    1.方法一:采用OleDB读取EXCEL文件: 把EXCEL文件当做一个数据源来进行数据的读取操作,实例如下: public DataSet ExcelToDS(string Path) { stri ...

  5. [CareerCup] 17.2 Tic Tac Toe 井字棋游戏

    17.2 Design an algorithm to figure out if someone has won a game oftic-tac-toe. 这道题让我们判断玩家是否能赢井字棋游戏, ...

  6. SQL Left Join, Right Join, Inner Join, and Natural Join 各种Join小结

    在SQL语言中,存在着各种Join,有Left Join, Right Join, Inner Join, and Natural Join等,对于初学者来说肯定一头雾水,都是神马跟神马啊,它们之间到 ...

  7. LeetCode:N-Queens I II(n皇后问题)

    N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no tw ...

  8. 配置javac环境

    初始的javac是默认不可用,如下图: 系统变量->新建->变量名:JAVA_HOME 变量值:(C:\Program Files\Java\jdk1.7.0_03)(这只是我的JDK安装 ...

  9. QQ个人文件夹中的文件被占用,解决办法

    我的情况是记住密码的账号不可以登录,不记住密码的账号确可以登录,突然就这样,我也很郁闷. 找到路径C:\Users\Public\Documents\Tencent\QQ下的UserDataInfo. ...

  10. 适配iOS10及Xcode8

    一.证书管理 用Xcode8打开工程后,比较明显的就是下图了,这个是苹果的新特性,可以帮助我们自动管理证书.建议大家勾选这个Automatically manage signing(Ps.但是在bea ...