(7)nginx: 搭建 nginx+php环境
来源:互联网 发布:volte网络分为 编辑:程序博客网 时间:2024/06/06 10:07
注意: 我们编译的PHP 要有如下功能:
连接mysql, gd,ttf, 以fpm(fascgi)方式运行
1 安装 mysql : yum -y install mysql mysql-server mysql-devel2 下载php-5.6.2 wgethttp://cn2.php.NET/distributions/php-5.6.2.tar.gz3 解压 tar -zxvf php-5.6.2.tar.gz4 切换到 php-5.6.2./configure --prefix=/usr/local/software/php/install \--with-mysql=mysqlnd \--enable-mysqlnd \--with-gd \--enable-gd-native-ttf\--enable-gd-jis-conv \--enable-fpm5.出现未安装的错误,直接用yum 进行安装即可 记得不要忘了装上 -devel (libcurl libpng libcrul12等等)6.出现找不到文件路径的情况下 用find / -name 'name'去查找一下7.出现warning 的情况大多是因为版本已经默认安装了,可以去掉该行8.make9.make install
1
cd
php-5.6.2
cp php.ini-production /usr/local/php/etc/php.inicp /usr/local/php/etc/php-fpm.conf.default.conf php-fpm.conf
/usr/local/php/sbin/php-fpm -t
cp /usr/local/src/php-5.3.27/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmchmod 755 /etc/init.d/php-fpmservice php-fpm start
chkconfig php-fpm on
ps aux |grep php-fpm
netstat -ant |grep 9000
安装nginx
1
2
wget
http:
//nginx
.org
/download/nginx-1
.6.2.
tar
.gz
//
最新稳定版哦
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2./configure \--prefix=/usr/local/nginx \--with-http_realip_module \--with-http_sub_module \--with-http_gzip_static_module \--with-http_stub_status_module \--with-pcre
make
make install
1
2
ln
-sf
/usr/local/nginx/sbin/nginx
/usr/sbin
1
nginx -t 测试一下吧,成功了吧,是不是很有成就感,别着急 咱们继续!
> /usr/local/nginx/conf/nginx.conf
vim /usr/local/nginx/conf/nginx.conf
user nobody nobody;worker_processes 2;error_log /usr/local/nginx/logs/nginx_error.log crit;pid /usr/local/nginx/logs/nginx.pid;worker_rlimit_nofile 51200;events{ use epoll; worker_connections 6000;}http{ include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 3526; server_names_hash_max_size 4096; log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]' '$host "$request_uri" $status' '"$http_referer" "$http_user_agent"'; sendfile on; tcp_nopush on; keepalive_timeout 30; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; connection_pool_size 256; client_header_buffer_size 1k; large_client_header_buffers 8 4k; request_pool_size 4k; output_buffers 4 32k; postpone_output 1460; client_max_body_size 10m; client_body_buffer_size 256k; client_body_temp_path /usr/local/nginx/client_body_temp; proxy_temp_path /usr/local/nginx/proxy_temp; fastcgi_temp_path /usr/local/nginx/fastcgi_temp; fastcgi_intercept_errors on; tcp_nodelay on; gzip on; gzip_min_length 1k; gzip_buffers 4 8k; gzip_comp_level 5; gzip_http_version 1.1; gzip_types text/plain application/x-javascript text/css text/htm application/xml;server{ listen 80; server_name localhost; index index.html index.htm index.php; root /usr/local/nginx/html;
#关键代码 location ~ \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php;
#脚本位置 fastcgi_param SCRIPT_FILENAME /usr/local/software/ngnix/install/z_com/test.php; }}}
测试是否解析php文件
vim /usr/local/nginx/html/2.php
<?php echo "测试php是否解析";?>
curl localhost/2.php
0 0
- (7)nginx: 搭建 nginx+php环境
- nginx php环境搭建
- 搭建php-nginx环境
- nginx+php环境搭建说明
- Nginx+PHP(FastCGI)环境搭建
- Nginx+PHP-FPM环境搭建
- nginx+php-fpm环境搭建
- nginx+php +mysql环境搭建
- windows nginx php 环境搭建
- MAC搭建PHP环境:PHP+Nginx+yaf
- CentOS 7 上编译安装Nginx,搭建PHP运行环境。
- CentOS 7 yum nginx MySQL PHP 简易环境搭建
- CentOS 7 yum nginx MySQL PHP 简易环境搭建
- CentOS 7 yum nginx MySQL PHP 简易环境搭建
- CentOS 7 yum nginx MySQL PHP 简易环境搭建
- CentOS 7 yum nginx MySQL PHP 简易环境搭建
- CentOS 7 yum nginx MySQL PHP 简易环境搭建
- Nginx安装及nginx+php环境的搭建
- 你若安好
- Effective java学习笔记(1)
- 【SSH】Struts2初识
- Android布局隐藏最上面标题行
- Leetcode #53 Maximum Subarray
- (7)nginx: 搭建 nginx+php环境
- CentOS7.0环境下MySQL5.6.34安装教程
- 使用PHP GD库生成缩略图
- 汇编基础(五)
- java流程控制条件判断
- sizeof的常见用法
- 微信开发
- 编写高质量代码:改善JavaScript程序建议--函数式编程
- 【jsp笔记】转发与重定向的区别