由于本人水平有限,以下记录仅作参考。

下面贴出我的一份正常运行的nginx服务器虚拟机配置。/usr/local/nginx/conf/vhost/www.xsll.com.conf

 server {
listen ;              #虚拟主机监听端口
server_name www.xsll.com;        #虚拟主机名称 #charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main; root /home/wwwroot/default/discuz/upload;  #你的项目目录
index index.php index.html index.htm;     #默认寻找的文件 location / {
try_files $uri $uri/ =;
if (!-e $request_filename){
rewrite ^/(.*)?$ /$.php?last;
  }
} error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
location ~ \.php$ {
#root html;
try_files $uri = ;
fastcgi_pass unix:/tmp/php-cgi.sock;  #这一行很重要,路径要与PHP配置文件中的监听路径相同,但前面要加unix:/
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

下面我贴出我的php的配置文件/user/local/php/etc/php-fpm.conf

 [global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice [www]
listen = /tmp/php-cgi.sock
listen.backlog = -
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode =
user = www
group = www
pm = dynamic
pm.max_children =
pm.start_servers =
pm.min_spare_servers =
pm.max_spare_servers =
request_terminate_timeout =
request_slowlog_timeout =
slowlog = var/log/slow.log

可以看到在虚拟主机配置的38行:fastcgi_pass unix:/tmp/php-cgi.sock;这个路径正式php配置文件中第7行:listen = /tmp/php-cgi.sock;这样nginx虚拟机就支持了PHP程序解析了。

nginx虚拟机配置(支持php)的更多相关文章

  1. nginx之 nginx虚拟机配置

    1.配置通过域名区分的虚拟机[root@mysql03 nginx]# cat conf/nginx.confworker_processes 1; events { worker_connectio ...

  2. nginx虚拟机配置

    #虚拟主机的配置server {#监听端口listen 80;#服务器域名server_name localhost;#网页的默认编码#charset koi8r;#访问该虚拟主机的日志位置#acce ...

  3. Nginx安装、平滑升级与虚拟机配置

    Nginx 高性能HTTP反向代理服务器,也是 LAMP/POP3/SMTP代理服务器 由内核和模块组成,内核通过找配置文件讲客户端请求映射到一个location(location是Nginx配置中的 ...

  4. Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持

    前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...

  5. nginx配置支持http2

    1.简介 nginx 配置支持http2.目前大多数网站都是http1.1(如果你没有特别配置过的话) 一切都是为了访问更快. 2.如何查看自己网站的http版本 最简单的方法就F12啊,我这里是火狐 ...

  6. 转自《https安全链接的配置教程:startSSl免费证书申请与nginx的https支持配置》

    一.什么是 SSL 证书,什么是 HTTPS 网站? SSL证书是数字证书的一种,类似于驾驶证.护照和营业执照的电子副本.SSL证书通过在客户端浏览器和Web服务器之间建立一条SSL安全通道(Secu ...

  7. Nginx配置支持https协议-应用实践

    Nginx配置支持https协议-应用实践 https简介 HTTPS 是运行在 TLS/SSL 之上的 HTTP,与普通的 HTTP 相比,在数据传输的安全性上有很大的提升. TLS是传输层安全协议 ...

  8. nginx 配置支持URL HTML5 History 模式 与 设置代理

    拾人牙慧:https://segmentfault.com/q/1010000007140360 nginx 配置支持URL HTML5 History 模式 location / { try_fil ...

  9. nginx+jwplayer配置flv/MP4点播系统, 视频拖动支持

    一 配置nginx 1. 下载 nginx 最新版 http://nginx.org/ 2. 安装依赖库, 以ubuntu为例 apt-get install libpcre3 libpcre3-de ...

随机推荐

  1. NavigationController的返回按钮自定义

    假设需求时这样: NavigationController下有2个视图,从A视图会Push到B视图,默认情况下,当显示视图B时,视图B的导航bar上会出现返回按钮,按钮标题文字默认为A视图的title ...

  2. Python迭代器,生成器--精华中的精华

    1. 迭代器 迭代器是访问集合元素的一种方式.迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束.迭代器只能往前不会后退,不过这也没什么,因为人们很少在迭代途中往后退.另外,迭代器的一大 ...

  3. ThinkPHP中:使用递归写node_merge()函数

    需求描述: 现有一个节点集合 可以视为一个二维数组 array(5) { [0] => array(4) { ["id"] => string(1) "1&q ...

  4. Query DSL(2)----Full text queries

    Match Query match查询接受文本/数值/日期 { "match" : { "message" : "this is a test&quo ...

  5. CentOS 引导 Win10 启动项

    因为无聊,所以想尝试一下双系统,所以在win10的基础之上,装了一个Linux系统,之前装过Ubuntu,几乎都是自动完成的无任何压力.但是想着Ubuntu好像更新换代有点快,所以换了个能用比较久的C ...

  6. 组合 Lucas定理

    组合 Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u [Submit]   [Go Ba ...

  7. redis C接口hiredis 简单函数使用介绍

    hiredis是redis数据库的C接口,目前只能在linux下使用,几个基本的函数就可以操作redis数据库了. 函数原型:redisContext *redisConnect(const char ...

  8. PyCharm基本操作

    1.1 PyCharm基本使用 视频学习连接地址:http://edu.51cto.com/course/9043.html 1.1.1 在Pycharm下为你的Python项目配置Python解释器 ...

  9. windows访问控制列表 --ACL(Access Control List)

    1.定义 ACL是一个windows中的表示用户(组)权限的列表. Access Control List(ACL) Access Control Entry(ACE) ... 2.分类 ACL分为两 ...

  10. 对Jquery中的ajax再封装,简化操作

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...