| |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
-> PHP知识库 -> Django and WordPress on Nginx -> 正文阅读 |
|
[PHP知识库]Django and WordPress on Nginx |
In order to serve WordPress and Django on the same Nginx server, you must use the alias directive to map the location of WordPress to a subdirectory. In the Nginx configuration below, I have WordPress served from the /diamond-blog subdirectory. # the upstream component nginx needs to connect to upstream django-tda-prod { server unix:///home/daymon/thediamondapp/prod/thediamondapp/tda_prod.sock; } # upstream for wordpress php requests upstream wordpress-prod-php-handler { server unix:/var/run/php/php7.4-fpm.sock; } # configuration of the server server { server_name thediamondapp.com www.thediamondapp.com; gzip_static on; client_max_body_size 5M; charset utf-8; root /home/daymon/thediamondapp/prod/public/; # Only allow connections by domain name if ( $host !~* ^(thediamondapp.com|www.thediamondapp.com)$ ) { return 444; } # Django static files location /static/ { alias /home/daymon/thediamondapp/prod/public/static/; expires 7d; } # Sitemap location ~ ^/(?P<file>sitemap-?.*\.xml)$ { try_files /$file =404; } # Favicon location = /favicon.ico { access_log off; log_not_found off; } # Send all non-media requests to the Django server. location / { uwsgi_pass django-tda-prod; include uwsgi_params; } # Serve wordpress from subdirectory location /diamond-blog { alias /home/daymon/thediamondapp/blog/prod; index index.php; try_files $uri $uri/ /diamond-blog/index.php?$args; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass wordpress-prod-php-handler; } } } Within the same location block, you’ll want to embed another location block for handling PHP files from WordPress. Since Django doesn’t use PHP, it makes sense to put this location block here. In this location block, please note how we use the?$request_filename?variable rather than?$document_root$fastcgi_script_name?according to?Nginx Pitfalls and Common Mistakes. For a full walkthrough of configuring Django and WordPress together, check out the video below, and please let me know if you have any question in the comments section. |
|
PHP知识库 最新文章 |
Laravel 下实现 Google 2fa 验证 |
UUCTF WP |
DASCTF10月 web |
XAMPP任意命令执行提升权限漏洞(CVE-2020- |
[GYCTF2020]Easyphp |
iwebsec靶场 代码执行关卡通关笔记 |
多个线程同步执行,多个线程依次执行,多个 |
php 没事记录下常用方法 (TP5.1) |
php之jwt |
2021-09-18 |
|
上一篇文章 下一篇文章 查看所有文章 |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 | -2024/11/15 1:16:54- |
|
网站联系: qq:121756557 email:121756557@qq.com IT数码 |