ansible配置nginx支持fastcgi
程序员文章站
2022-03-11 08:33:34
...
---
- hosts: 10.0.0.171
vars:
nginxver: 1.20.1
appdir: "/apps/nginx-{{nginxver}}"
htmldir: /data/nginx/html
tasks:
- name: create http conf
file: path={{appdir}}/conf/http state=directory owner=nginx group=nginx
- name: create htmldir
file: path={{htmldir}} state=directory owner=nginx group=nginx
- name: exit nginx.conf
shell: sed -i "/^[[:space:]]*server {/i include {{appdir}}/conf/http/*.conf;" {{appdir}}/conf/nginx.conf
- name: create new conf
copy:
content: |
server {
listen 80;
server_name www.huangguanzhou.com;
root /data/nginx/html;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/(ping|pm_status)$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
}
}
dest: "{{appdir}}/conf/http/test.conf"
- name: restart nginx
service: name=nginx state=restarted enabled=yes
上一篇: ERROR:爬虫相关
下一篇: 一些常用的函数技巧
推荐阅读
-
Nginx(Tengine)启用 SPDY 支持的配置方法
-
nginx支持codeigniter的pathinfo模式url重写配置写法示例
-
在nginx中配置pathinfo模式支持thinkphp的URL重写
-
CentOS 6.1 环境中部署nginx、php(包括fastcgi)、虚拟主机配置
-
Gentoo 下安装与配置Nginx+ MySQL + PHP (fastcgi) 环境步骤分享
-
Nginx下配置pathinfo及ThinkPHP的URL Rewrite模式支持
-
Nginx配置支持ThinkPHP的PATH_INFO
-
Nginx下支持Thinkphp URL Rewrite的配置示例
-
ubuntu上配置Nginx+PHP5 FastCGI服务器配置
-
nginx安装及配置支持php的教程(全)