ubuntu 安装nginx和php
2015-11-10 00:23
441 查看
ubuntu14.04.3
nginx下载地址:http://nginx.org/download/nginx-1.6.0.tar.gz
php下载地址:http://php.net/get/php-5.6.15.tar.gz/from/a/mirror
安装所有软件需要的包:
安装nginx需要的包:
安装php需要的包:
第一步安装nginx
wget http://nginx.org/download/nginx-1.6.0.tar.gz
tar xvf nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --prefix=/usr/local/nginx
make
make install
开启nginx:/usr/local/nginx/sbin/nginx
重启nginx:/usr/local/nginx/sbin/nginx -s reload
第二步安装php
注:为了让php支持imagecreatefromjpeg()函数,参考http://www.nginx.cn/tag/gd,gd2.1下载地址:https://github.com/libgd/libgd/releases/download/gd-2.1.1/libgd-2.1.1.tar.gz
wget php压缩包
cd php5.6
./configure --prefix=/usr/local/php5.6 --enable-fpm --with-curl --with-mysql --enable-mysqlnd --with-pdo-mysql --enable-mbstring --enable-tokenizer --with-zlib --with-pcre-dir --with-mcrypt=/usr/local/mcrypt --enable-sockets --enable-inline-optimization
--enable-sysvsem --enable-sysvshm --enable-pcntl --with-pcre-regex --with-jpeg-dir --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysqli=mysqlnd --enable-sockets --enable-sockets --with-zlib --with-iconv --enable-zip
make
make install
安装gd库
# apt-get install php5-gd
php安装好后,还不能解析php的文件,此时需要2步:
1.新增php-fpm.conf文件,复制/opt/local/php5.6/conf/php-fpm.conf.default 改名为php-fpm.conf
2.php-fpm.conf文件查看组和用户名
开启php-fpm:/opt/local/php5.6/sbin/php-fpm
(完)
nginx下载地址:http://nginx.org/download/nginx-1.6.0.tar.gz
php下载地址:http://php.net/get/php-5.6.15.tar.gz/from/a/mirror
安装所有软件需要的包:
sudo apt-get install build-essential sudo apt-get install libtool
安装nginx需要的包:
sudo apt-get update sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install openssl libssl-dev libperl-dev
安装php需要的包:
sudo apt-get install libxml2-dev
apt-get install libmcrypt-dev libpng-devel apt-get -y install libjpeg-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libxml2-dev
第一步安装nginx
wget http://nginx.org/download/nginx-1.6.0.tar.gz
tar xvf nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --prefix=/usr/local/nginx
make
make install
开启nginx:/usr/local/nginx/sbin/nginx
重启nginx:/usr/local/nginx/sbin/nginx -s reload
第二步安装php
注:为了让php支持imagecreatefromjpeg()函数,参考http://www.nginx.cn/tag/gd,gd2.1下载地址:https://github.com/libgd/libgd/releases/download/gd-2.1.1/libgd-2.1.1.tar.gz
wget php压缩包
cd php5.6
./configure --prefix=/usr/local/php5.6 --enable-fpm --with-curl --with-mysql --enable-mysqlnd --with-pdo-mysql --enable-mbstring --enable-tokenizer --with-zlib --with-pcre-dir --with-mcrypt=/usr/local/mcrypt --enable-sockets --enable-inline-optimization
--enable-sysvsem --enable-sysvshm --enable-pcntl --with-pcre-regex --with-jpeg-dir --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysqli=mysqlnd --enable-sockets --enable-sockets --with-zlib --with-iconv --enable-zip
make
make install
安装gd库
# apt-get install php5-gd
php安装好后,还不能解析php的文件,此时需要2步:
1.新增php-fpm.conf文件,复制/opt/local/php5.6/conf/php-fpm.conf.default 改名为php-fpm.conf
2.php-fpm.conf文件查看组和用户名
开启php-fpm:/opt/local/php5.6/sbin/php-fpm
(完)
相关文章推荐
- Nginx学习回顾总结 部分:
- mac nginx操作
- 拥抱Android:编译nginx搭建移动平台
- django+nginx+uwsgi 搭建环境
- windows配置nginx实现负载均衡集群
- Nginx 在windows下配合iis搭建负载均衡过程 [转]
- 使用Nginx作缓存服务器以及删除其缓存文件的方法
- nginx thinkphp路由支持
- 发现一个nginx LUA开发Web App的框架
- 通过nginx配置文件抵御攻击
- Nginx使用naxsi防xss、防注入攻击配置
- Win10系统80端口被System占用 造成Apache/IIS/Nginx不能启动的解决办法
- 使用vim打开某文件一直出现Swap file ".nginx.conf.swp" already exists!
- nginx 笔记(一)
- nginx 404
- nginx多虚拟主机配置
- windows下nginx安装、配置与使用
- Nginx 增加 SPDY 支持并测试
- Nginx下让SSL支持SPDY协议
- nginx no-cache