ini Nginx Vhost模板

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini Nginx Vhost模板相关的知识,希望对你有一定的参考价值。

server {
  listen 80;
  server_name local.dev;
  access_log  /var/log/nginx/nginx.access.log;

  root /media/sf_SITIOS;
  index index.php index.html;

  # Don't cache rules
  if ($request_uri ~* "/(folder/|file.php)")
  {
    set $no_cache 1;
  }

  # PHP FPM
  location ~* \.php$ {
    fastcgi_index   index.php;
    #fastcgi_pass    127.0.0.1:9000;
    #fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    #fastcgi_cache Nginx;
    fastcgi_cache_valid 200 5m;
    fastcgi_cache_bypass $no_cache;
    fastcgi_no_cache $no_cache;
    add_header X-Cache $upstream_cache_status;
 }
 location ~* /{
   autoindex off;
 }

 # Cache static files such as images, styles and scripts
 location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
   expires 60m;
 }

  # Health test
  if ($request_uri ~* "^/ok$") {
    return 200;
  }
  
  # Block all svn access
  if ($request_uri ~* "/\.svn") {
    return 404;
  }
  
  # Block all git access
  if ($request_uri ~* "/\.git") {
    return 404;
  }
}

以上是关于ini Nginx Vhost模板的主要内容,如果未能解决你的问题,请参考以下文章

ini nginx vhost配置PHP-FPM

ini vhost.conf

nginx+uwsgi

centos7.3部署django用uwsgi和nginx[未解决]

NGINX VHOST配置文件的使用 之四

Nginx 配置多站点vhost