1. #参考:nginx 官方drupal 配置 - Drupal | NGINX
  2.  
  3. server {
  4. server_name example.com;
  5. root /var/www/drupal8; ## <-- Your only path reference.
  6.  
  7. location = /favicon.ico {
  8. log_not_found off;
  9. access_log off;
  10. }
  11.  
  12. location = /robots.txt {
  13. allow all;
  14. log_not_found off;
  15. access_log off;
  16. }
  17.  
  18. # Very rarely should these ever be accessed outside of your lan
  19. location ~* \.(txt|log)$ {
  20. allow 192.168.0.0/;
  21. deny all;
  22. }
  23.  
  24. location ~ \..*/.*\.php$ {
  25. return ;
  26. }
  27.  
  28. location ~ ^/sites/.*/private/ {
  29. return ;
  30. }
  31.  
  32. # Block access to scripts in site files directory
  33. location ~ ^/sites/[^/]+/files/.*\.php$ {
  34. deny all;
  35. }
  36.  
  37. # Allow "Well-Known URIs" as per RFC
  38. location ~* ^/.well-known/ {
  39. allow all;
  40. }
  41.  
  42. # Block access to "hidden" files and directories whose names begin with a
  43. # period. This includes directories used by version control systems such
  44. # as Subversion or Git to store control files.
  45. location ~ (^|/)\. {
  46. return ;
  47. }
  48.  
  49. location / {
  50. # try_files $uri @rewrite; # For Drupal <=
  51. try_files $uri /index.php?$query_string; # For Drupal >=
  52. }
  53.  
  54. location @rewrite {
  55. rewrite ^/(.*)$ /index.php?q=$;
  56. }
  57.  
  58. # Don't allow direct access to PHP files in the vendor directory.
  59. location ~ /vendor/.*\.php$ {
  60. deny all;
  61. return ;
  62. }
  63.  
  64. # In Drupal , we must also match new paths where the '.php' appears in
  65. # the middle, such as update.php/selection. The rule we use is strict,
  66. # and only allows this pattern with the update.php front controller.
  67. # This allows legacy path aliases in the form of
  68. # blog/index.php/legacy-path to continue to route to Drupal nodes. If
  69. # you do not have any paths like that, then you might prefer to use a
  70. # laxer rule, such as:
  71. # location ~ \.php(/|$) {
  72. # The laxer rule will continue to work if Drupal uses this new URL
  73. # pattern with front controllers other than update.php in a future
  74. # release.
  75. location ~ '\.php$|^/update.php' {
  76. fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
  77. # Security note: If you're running a version of PHP older than the
  78. # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
  79. # See http://serverfault.com/q/627903/94922 for details.
  80. include fastcgi_params;
  81. # Block httpoxy attacks. See https://httpoxy.org/.
  82. fastcgi_param HTTP_PROXY "";
  83. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  84. fastcgi_param PATH_INFO $fastcgi_path_info;
  85. fastcgi_param QUERY_STRING $query_string;
  86. fastcgi_intercept_errors on;
  87. # PHP socket location.
  88. #fastcgi_pass unix:/var/run/php5-fpm.sock;
  89. # PHP socket location.
  90. fastcgi_pass unix:/var/run/php/php7.-fpm.sock;
  91. }
  92.  
  93. # Fighting with Styles? This little gem is amazing.
  94. # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <=
  95. location ~ ^/sites/.*/files/styles/ { # For Drupal >=
  96. try_files $uri @rewrite;
  97. }
  98.  
  99. # Handle private files through Drupal. Private file's path can come
  100. # with a language prefix.
  101. location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >=
  102. try_files $uri /index.php?$query_string;
  103. }
  104.  
  105. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
  106. try_files $uri @rewrite;
  107. expires max;
  108. log_not_found off;
  109. }
  110. }

转:nginx 官方drupal 配置 - Drupal | NGINX的更多相关文章

  1. CentOS下nginx+php的配置及nginx开机启动配置

    关闭防火墙 (不然外链接是访问不了 apache) service iptables stop 关闭安全系统 SELinux( 不然报403 访问页面错误 ) 1.Nginx安装主要在于配置文件的修改 ...

  2. nginx之旅(第三篇):代理、正向代理、反向代理、代理的原理、nginx反向代理场景、nginx反向代理配置、nginx反向代理语法

    一.代理服务与反向代理 什么是代理服务 代理-代理办理(代理理财.代理收货.代理购物等等). 一般情况下,如果没有特别说明,代理技术默认说的是正向代理技术.关于正向代理的概念如下: 正向代理(forw ...

  3. nginx反向代理配置(nginx.conf+proxy_set_header)

    转载:https://blog.csdn.net/bjsunwei/article/details/62231209 location / { proxy_pass http://test; prox ...

  4. nginx 多域名配置 (nginx如何绑定多个域名)

         nginx绑定多个域名可又把多个域名规则写一个配置文件里,也可又分别建立多个域名配置文件,我一般为了管理方便,每个域名建一个文件,有些同类域名也可又写在一个总的配置文件里. 一.每个域名一个 ...

  5. 隔壁小孩都要知道的Drupal配置

    i春秋作家:Arizona 原文来自:隔壁小孩都要知道的Drupal配置 隔壁小孩都要知道的Drupal配置 Drupal是一个开源的PHP内容管理系统,具有相当复杂的架构.它还具有强大的安全模型.感 ...

  6. Nginx详解七:Nginx基础篇之Nginx官方模块

    Nginx官方模块 --with-http_stub_status_module:Nginx的客户端状态,用于监控连接的信息,配置语法如下:配置语法:stub_status;默认状态:-配置方法:se ...

  7. CentOS 8 下 nginx 服务器安装及配置笔记

    参考文档 nginx官方文档 安装 在CentOS下,nginx官方提供了安装包可以安装 首先先安装前置软件 sudo yum install yum-utils 然后将nginx官方源加入到yum源 ...

  8. Nginx安装与配置-Centos7

    Nginx是一款高性能免费开源网页服务器,也可用于反向代理和负载均衡服务器.该软件由伊戈尔·赛索耶夫于2004年发布,2019年3月11日,Nginx被F5 Networks以6.7亿美元收购.201 ...

  9. Nginx Gzip 压缩配置

    Nginx Gzip 压缩配置 随着nginx的发展,越来越多的网站使用nginx,因此nginx的优化变得越来越重要,今天我们来看看nginx的gzip压缩到底是怎么压缩的呢? gzip(GNU-Z ...

随机推荐

  1. easyui combobox下拉框复制后再禁用,点击不会出现下拉框

    easyui combobox下拉框禁用,点击不会出现下拉框 需要做到,在给easyui combobox赋值后,再禁用easyui combobox 解决办法: $("#time-sele ...

  2. IO概述、异常、File文件类_DAY19

    IO概述: 操作数据的工具 IO流,即数据流,数据像水流一样通过IO工具进行传输. 程序  <IO>   硬盘 绝对路径与相对路径 1:异常(理解) (1)就是程序的非正常情况. 异常相关 ...

  3. Java之集合(十五)Set综述

    转载请注明源出处:http://www.cnblogs.com/lighten/p/7427554.html 1.前言 原本按照顺序应该是list.queue然后就是set的讲解,但是因为set的实现 ...

  4. Spring Security构建Rest服务-0600-SpringSecurity基本原理

    一.引入 只要引入了spring-boot-starter-security,所有的服务都会被保护起来.启动项目,打开时所有的controller会被保护起来,随便访问一个,如http://local ...

  5. 笛卡尔积算法的sku

    1.笛卡尔积在形式上比较容易理解,但作为按钮操作DOM的时候,我的思路大体还可以,有些偏差.看到这种矩行方阵,首先联想到二维数组,事实上这种方法完全可以实现,但是在性能和编码速度上都有弊端. 2.以下 ...

  6. R语言---- 数据的基本运算

    一.基本运算符号 1.基本数学计算 +.-.*./.^.%%(求模).%/%(整除)注意:求模运算两边若为小数,则整数和小数部分分别求模.例:5.6%%2.2 2.比较运算 >.<.> ...

  7. xgb 绘制

    1.windows安装Graphviz2.38 安装地址:https://graphviz.gitlab.io/_pages/Download/Download_windows.html 2.在pyt ...

  8. WPF样式动画Trigger.EnterActions和Trigger.ExitActions(ExitActions其实可以不做任何事情)

    这是一个鼠标移入后,控件往左移动的动画: <Style TargetType="{x:Type StackPanel}"> <Setter Property=&q ...

  9. eclipse + maven 环境配置

    软件152 余建强 第一步:准备以下软件并进行安装 1. jdk1.7或者以上为最佳: 官方下载地址:http://www.oracle.com/technetwork/java/javase/dow ...

  10. Thinkphp 3.2.3配置百度编辑器(UEditor)

    Thinkphp 3.2.3配置百度编辑器(UEditor) 1.把百度编辑器放到项目的Public目录下 命名为:UEditor 2.找到thinkphp框架系统自带类中的Html.class.ph ...