我有一台debian机器,我为我的web服务器工作进程安装了nginx.但是我们只需要在默认的nginx配置中更改一下wordpress,它位于/ etc / nginx / sites-enabled /!/etc/nginx/sites-enabled/wordpress.com/etc/nginx/site...
我有一台debian机器,我为我的web服务器工作进程安装了nginx.但是我们只需要在默认的nginx配置中更改一下wordpress,它位于/ etc / nginx / sites-enabled /!
/etc/nginx/sites-enabled/wordpress.com
/etc/nginx/sites-enabled/drupal.com
我可以在单个debian机器下知道这两个网站的样本nginx配置.
解决方法:
您可以使用nginx运行多个站点,类似于apache vhost.
在/ etc / nginx / sites-enabled中,您可以添加两个vhost
wordpress.example.com
server {
listen 80;
server_name wordpress.example.com;
root /var/www/wordpress;
# if ($http_host != "www.example.com") {
# rewrite ^ http://www.example.com$request_uri permanent;
# }
index index.php index.html;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$$scheme://$host$uri/ permanent;
location ~* \.(jpg|jpeg|png|gif|css|js|ico)${
expires max;
log_not_found off;
}
location ~ \.php${
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
和
drupal.example.com
server {
listen 80;
server_name drupal.example.com;
root /var/www/drupal;
# if ($http_host != "www.example.com") {
# rewrite ^ http://www.example.com$request_uri permanent;
# }
index index.php index.html;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$$scheme://$host$uri/ permanent;
location ~* \.(jpg|jpeg|png|gif|css|js|ico)${
expires max;
log_not_found off;
}
location ~ \.php${
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9001;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
沃梦达教程
本文标题为:我们可以将nginx用于wordpress和drupal吗?
猜你喜欢
- PbootCMS网站标题描述等标签限制字数的办法 2023-07-08
- 织梦DedeCMS如何实现文章列表隔行换色变样式 2023-07-08
- 织梦采集标题不完整的解决方法,修改标题长度 2022-07-14
- 织梦dedecms点击数统计控制(刷新页面不新增点击数) 2022-07-20
- 怎么安装使用PbootCMS网站模板 2023-07-08
- pbootcms文章插入图片不固定宽高的办法 2023-07-08
- 织梦dedecms最全的清除文档的sql语句 2022-06-24
- dedecms织梦列表页标题增加页码的方法 2022-07-22
- PbootCMS伪静态配置教程以及各web容器配置规则 2023-07-08
- pbootcms去除ueditor编辑器图片自动添加的title和alt属性 2023-07-08
