一、配置

#vi /usr/local/nginx/conf/vhost/test.com.conf

写入:

server

{

listen 80;

server_name test.com test1.com test2.com;

index index.html index.htm index.php;

root /data/nginx/test.com;

if ($host != 'test.com' ) {

rewrite ^/(.*)$ http://test.com/$1 permanent;

}

location ~ \.php$

{

include fastcgi_params;

fastcgi_pass unix:/tmp/php-fcgi.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /data/nginx/test.com$fastcgi_script_name;

}

access_log /tmp/1.log combined_realip;

}

//fastcgi_pass用来指定php-fpm的地址

# vim /data/nginx/test.com/3.php

写入:

<?php

phpinfo();

?>

# curl -x

curl -x192.168.244.128:80 test.com/3.php

test.com/3.php

写入:

<?php

phpinfo();

?>

重新加载nginx

# /usr/local/nginx/sbin/nginx -t

# /usr/local/nginx/sbin/nginx -s reload

# curl -x192.168.244.128:80 test.com/3.php

LNMP配置——Nginx配置 —— Nginx解析PHP的更多相关文章

  1. LNMP环境搭建:Nginx安装、测试与域名配置

    Nginx作为一款优秀的Web Server软件同时也是一款优秀的负载均衡或前端反向代理.缓存服务软件 2.编译安装Nginx (1)安装Nginx依赖函数库pcre pcre为“perl兼容正则表达 ...

  2. 09 . Nginx配置LNMP和LNMT架构

    安装LNMP架构 环境清单 list CentOS7.3 proxysql-2.0.12-1-centos7.x86_64.rpm mysql-5.7.23-1.el7.x86_64.rpm-bund ...

  3. 【转】【Nginx】Nginx 入门教程 + 常用配置解析

    == Nginx介绍和安装 == Nginx是一个自由.开源.高性能及轻量级的HTTP服务器及反转代理服务器, 其性能与IMAP/POP3代理服务器相当.Nginx以其高性能.稳定.功能丰富.配置简单 ...

  4. 初识nginx——配置解析篇

    一.nginx的介绍 nginx是由俄罗斯人开发的一款高性能的http和反向代理服务器,也可以用来作为邮件代理.相比较于其他的服务器,具有占用内存少,稳定性高等优势 二.nginx的配置 nginx的 ...

  5. Nginx 配置解析

    概述:本篇文章主要对Nginx配置文件中一些常用配置进行了讲解,和如何使用Docker进行安装Nginx.因为该文章是回首在工作闲暇之余整理的,还有待完善,如果有疑义和更好的建议的朋友可以留言给我. ...

  6. Nginx配置解析

    #运行用户,默认即是nginx,可不设置 #user nobody; #nginx进程,一般设置为和cpu核数一样 worker_processes 1; #;单个后台worker process进程 ...

  7. nginx 配置 https 并强制跳转(lnmp一键安装包)

    目录 一.安装包 二.配置 三.查看配置文件 3.1.设定强制跳转 https 3.2 Rewrite 常用全局变量举例 一.安装包 安装大家按照官方说的安装即可. ./install.sh lnmp ...

  8. Linux配置LNMP环境(一)配置Nginx

    注意:配置版本nginx-1.12.0,使用虚拟机安装linux.教程中的下载地址可能有变化.注意(在您看本教程之前首先需要对linux的基本操作熟悉) 1.  先cd到/usr/local/src ...

  9. lnmp之Nginx配置https加密访问

    配置lnmp之Nginx网站支持https加密访问 注: 1. 这里拿购买的(pxsnx.pxjy.com)证书来做样例 证书文件共有三个---> (pxsnxg.pxjy.com_ca.crt ...

随机推荐

  1. os-hackNOS-2(wp5.3本地文件包含 rbash绕过)

    一.信息收集 直接netdiscover,找到IP是 192.168.56.101 然后端口扫描一波 只打开了22和80端口,访问一下80端口,是apache首页,那就继续查目录赛.,发现了一个tsw ...

  2. msf 信息收集

    MSF信息收集 转载自天堂空气 一 MSF主机发现 0x1:搜索arp 0x2:使用use auxiliary/scanner/discovery/arp_sweep 模块,然后show option ...

  3. 『数据结构与算法』二叉查找树(BST)

    微信搜索:码农StayUp 主页地址:https://gozhuyinglong.github.io 源码分享:https://github.com/gozhuyinglong/blog-demos ...

  4. 008.NET5_IIS安装教程

    控制面板->程序->启动或关闭Windows功能

  5. zsh & for loop bug

    zsh & for loop bug ​for: command not found syntax error near unexpected token do' do' Unicode 编码 ...

  6. Iterators & Generators in depth

    Iterators & Generators in depth https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/It ...

  7. 微前端 & 微前端实践 & 微前端教程

    微前端 & 微前端实践 & 微前端教程 微前端 micro frontends https://micro-frontends.org/ https://github.com/neul ...

  8. linux move file / folder bash command

    linux move file / folder bash command mv $ which mv $ man mv # mv [-f] source target/ target folder ...

  9. React-Native Tutorials

    React-Native Tutorials https://egghead.io/courses/react-native-fundamentals part free https://egghea ...

  10. react hooks & props change & pagination current bug

    react hooks & props change & pagination current bug multi tables & pigination bug & ...