aliyun 主机Nginx 上配置Drupal 伪静态
网上找了好久没有正确的,后面直接在http://wiki.nginx.org/Drupal
上找到原文。但原文中复制过来会出现个 'root' rewrite directive is duplicate 错误和 server 第一列的错误。
对照aliyun上的预先设定的rewrite 发现它们都没有server {} 这个名,而且这个位置也在nginx -t 时报错了。
凝视了报错的位置,删除了不适用于drupal 7以下的配置。
- /alidata/server/nginx/sbin/nginx
-t
设置的时候用这个測试。
最后把conf 文件也设置好,重新启动下。
- /alidata/server/nginx/sbin/nginx
-s reload
server_name domain.tld;
#root /var/www/drupal7; ## <-- Your only path reference. # Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on; location = /favicon.ico {
log_not_found off;
access_log off;
} location = /robots.txt {
allow all;
log_not_found off;
access_log off;
} # This matters if you use drush prior to 5.x
# After 5.x backups are stored outside the Drupal install.
#location = /backup {
# deny all;
#} # Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
} location ~ \..*/.*\.php$ {
return 403;
} # No no for private
location ~ ^/sites/.*/private/ {
return 403;
} # Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
} location / {
# This is cool because no php is touched for static content
try_files $uri @rewrite;
} location @rewrite {
# You have 2 options here
# For D7 and above:
# Clean URLs are handled in drupal_environment_initialize().
rewrite ^ /index.php;
# For Drupal 6 and bwlow:
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn't be needed (GlobalRedirect)
#rewrite ^/(.*)$ /index.php?q=$1;
} location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
fastcgi_pass unix:/tmp/phpfpm.sock;
} # Fighting with Styles? This little gem is amazing.
# This is for D6
#location ~ ^/sites/.*/files/imagecache/ {
# This is for D7 and D8
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
} location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
aliyun 主机Nginx 上配置Drupal 伪静态的更多相关文章
- apache上.htaccess转向nginx上配置.htaccess伪静态规则
nginx上配置.htaccess伪静态规则 在apache上.htaccess转向,只要apache编译的时候指明支持rewrite模块即可. 但是换到nginx上方法会有不同,有人说把.htacc ...
- nginx上支持.htaccess伪静态的配置实例
本文介绍下,在nginx上配置.htaccess伪静态的方法,有需要的朋友参考下吧. 在apache上.htaccess转向,只要apache编译的时候指明支持rewrite模块即可. 但是换到ngi ...
- 在NGINX上配置HTTPS---血的教训--要重启NGINX
重启,不是重载!!! 是STOP & START 而不是RELOAD!!! 纠结了好几天...(难道有的NGINX上不用重启????) 你妹的,上次也是,,PHP-FPM,将一个PHP的程序连 ...
- linux上nginx上配置虚拟主机的相关配置
1.配置主配置: nginx/conf/nginx.conf 2.虚拟主机配置:nginx/conf/extra/learn.weixin.com.conf 配置完后,重启服务器!
- 或许是 Nginx 上配置 HTTP2 最实在的教程了
导读 从 2015 年 5 月 14 日 HTTP/2 协议正式版的发布到现在已经快有一年了,越来越多的网站部署了 HTTP2,HTTP2 的广泛应用带来了更好的浏览体验,只要是 Modern 浏览器 ...
- 在Nginx上配置ThinkPHP项目
前段时间用Apache配合TP开发了一个小型网站,也算是我使用TP的第一次实战.我习惯使用pathinfo模式,本地运行一切正常,然而部署到服务器上时,由于对方使用的是Nginx,默认是不支持Thin ...
- 在Nginx上配置多个站点
有时候你想在一台服务器上为不同的域名运行不同的站点.比如www.siteA.com作为博客,www.siteB.com作为论坛.你可以把两个域名的IP都解析到你的服务器上,但是没法在Nginx的根目录 ...
- 阿里云主机Nginx下配置NodeJS、Express和Forever
https://cnodejs.org/topic/5059ce39fd37ea6b2f07e1a3 AngularJS中文社区即运行在阿里云主机上,本站使用Nginx引擎,为了AngularJS,我 ...
- vue-cli 创建的项目,在 nginx 上配置启用浏览器缓存
nginx 配置,关键参数: server { listen 80; server_name xxx.xxx.xxx.xxx; charset utf-8; root /home/xxx/dist/; ...
随机推荐
- Special Subsequence(离散化线段树+dp)
Special Subsequence Time Limit: 5 Seconds Memory Limit: 32768 KB There a sequence S with n inte ...
- 如何在同一系统中启动多个 TOMCAT
<Server port="8005" shutdown="SHUTDOWN"> 接受server关闭指令的port号.我们叫关闭指令port. & ...
- HTML5.1就要来了
原文来自https://www.w3.org/blog/2016/04/working-on-html5-1/ 总结一下几个点: 1.六个月内,也就是到九月份的时候,HTML5.1会和大家见面. 2. ...
- 查询sql 语句的好坏
要找出mysql中低效的sql语句我们可以使用 EXPLAIN分析低效sql,但是在使用 EXPLAIN之前我需要开启mysql慢查询日志,这样才可以使用 EXPLAIN,下面我们一起来看看. 面对业 ...
- [置顶] cocos2d-x 植物大战僵尸(13)类似酷跑的【同一角色不同动画间的切换的实现】
有几天没和大家分享博客了,原因很简单,就是我在运行第12章所写的代码时:(开始一切正常,不过没多久就出现了内存泄露!.可能求成心切吧,当时没多加考虑就把代码发上去了.我在此对看过第12章得 ...
- django开发简易博客(一)
这几篇博客是根据GoodSpeed的博客该写的,看了他的博客收获很大,但是他的博客从第三篇开始,条理很不清晰,加之又是几年之前写的,编写环境发生很大改变,所以对他的博客进行了一个整理,加入了一些自己的 ...
- 深入探究VC —— 资源编译器rc.exe(3)
Windows应用程序中,图标.菜单.畏途.图标.工具条.对话框等是以资源的形式存在的.开发人员也可以自定义资源类型.如果一个程序使用了资源,那么它在构建时需要对资源进行编译.程序所使用的资源会在资源 ...
- IT第八天 - 类的应用、debug、项目开发模式优化
IT第八天 上午 类的应用 1.对象在实例化时是非常耗费系统资源的,因此要尽量减少new字段的使用 2.类的初始值是null,在使用未实例化的类时,很容易导致报错:NullExceptionPoint ...
- window.open 使用方法总结
[1.最基本的弹出窗口代码] <SCRIPT LANGUAGE="javascript"> <!-- window.open ('test.html') - ...
- 【Android 多媒体开发】 MediaPlayer 状态机 接口 方法 解析
作者 : 韩曙亮 转载请著名出处 : http://blog.csdn.net/shulianghan/article/details/38487967 一. MediaPlayer 状态机 介绍 ...