first nginx & php
pc-nginx-apache(for test install easy) http { upstream myapp1 { //---for balance server srv1.example.com; server srv2.example.com; server srv3.example.com; } server { listen 80; location / { proxy_pass http://myapp1; } }} server { location
pc->nginx->apache(for test install easy)
http { upstream myapp1 { //---for balance server srv1.example.com; server srv2.example.com; server srv3.example.com; } server { listen 80; location / { proxy_pass http://myapp1; } } }
server { location / { proxy_pass http://localhost:8080/; //---to apache } location ~ \.(gif|jpg|png)$ { //---to local root /data/images; } }
-------------------------------------------
env
kernel:3.10.0-123.el7.x86_64
nginx version: nginx/1.4.7 ./configure --prefix=/usr/local/nginx/ --with-pcre=/usr/local/pcre-7.9/(source code path) --with-zlib=/usr/local/zlib-1.2.8/(source code path)
php version :5.5.20 auto enable fastcgi ./configure --prefix=/usr/local/php --enable-debug --enable-fpm
config
1 #user nobody; 2 worker_processes 1; 3 4 #error_log logs/error.log; 5 #error_log logs/error.log notice; 6 #error_log logs/error.log info; 7 8 #pid logs/nginx.pid; 9 10 11 events { 12 worker_connections 1024; 13 } 14 15 16 http { 17 include mime.types; 18 default_type application/octet-stream; 19 20 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 21 # '$status $body_bytes_sent "$http_referer" ' 22 # '"$http_user_agent" "$http_x_forwarded_for"'; 23 24 #access_log logs/access.log main; 25 26 sendfile on; 27 #tcp_nopush on; 28 29 #keepalive_timeout 0; 30 keepalive_timeout 65; 31 32 #gzip on; 33 34 server { 35 listen 80; 36 server_name localhost; 37 38 #charset koi8-r; 39 40 #access_log logs/host.access.log main; 41 42 location / { 43 root html; 44 index index.php index.html index.htm; 45 } 46 47 #error_page 404 /404.html; 48 49 # redirect server error pages to the static page /50x.html 50 # 51 error_page 500 502 503 504 /50x.html; 52 location = /50x.html { 53 root html; 54 } 55 56 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 57 # 58 #location ~ \.php$ { 59 # proxy_pass http://127.0.0.1; 60 #} 61 62 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 63 # 64 location ~ \.php$ { 65 root /usr/local/nginx/html; 66 fastcgi_pass 127.0.0.1:9000; 67 fastcgi_index index.php; 68 include fastcgi.conf; 69 } 70 71 # deny access to .htaccess files, if Apache's document root 72 # concurs with nginx's one 73 # 74 #location ~ /\.ht { 75 # deny all; 76 #} 77 } 78 }nginx.conf
/usr/local/php/sbin/php-fpm
/usr/local/nginx/sbin/nginx
sysctl stop firewalld.service
systemctl stop firewalld.service
result
[root@localhost conf]# curl 127.0.0.1 | head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 56014 0 56014 0 0 9.8M 0 --:--:-- --:--:-- --:--:-- 10.6M
上一篇: drupal,该怎么处理
下一篇: 基于Innobackupex的全备恢复
推荐阅读
-
first nginx & php
-
服务器 - nginx php配置
-
PHP+FastCGI+Nginx配置PHP运行环境,fastcginginx_PHP教程
-
mysql - 探讨nginx与php-fpm是不是以多进程多线程方式运行的
-
nginx中如何配置java与php?使两个网站都能访问
-
PHP加Nginx实现动态裁剪图片方案_PHP教程
-
Nginx和PHP-FPM的启动/重启脚本
-
在CentOS/RHEL6.2/5.8,Fedora17/16上安装Nginx/PHP-FPM环境
-
Linux下从零开始安装配置Nginx服务器+PHP开发环境_php实例
-
nginx + php-fpm页面显示空白的问题_PHP教程