ini 使用Homebrew的OS X的Nginx虚拟主机设置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini 使用Homebrew的OS X的Nginx虚拟主机设置相关的知识,希望对你有一定的参考价值。


#
# A virtual host using mix of IP-, name-, and port-based configuration.
# This is based on using Homebrew for OS X. You can use this in other
# cases though, but you'll likely need to adjust some of the paths below.
#

server {
  # Replace this port with the right one for your requirements
  # listen 80 [default|default_server];  #could also be 1.2.3.4:80
  
  # This is set to 8080 because this conf is for Nginx running on OS X via brew.
  # Without root permissions you can not run an app and bind it to a lower port like 80.
  # That's ok, we have a solution.
  # Go here: https://github.com/coverall/nginx and look down at step 8a.
  listen 8080;
 
  # Multiple hostnames separated by spaces.  Replace these as well.
  server_name dev.local *.dev.local;

  # Extracts the subdomain to a variable
  # But sets the default to be 'mysite' for dev.local
  # ie. /usr/local/sites/mysite
  set $sub 'mysite';
  if ($host ~ "^(.*).dev.local") {
  	set $sub $1;
  }
 
  # and even better... 
  # this allows Lithium apps to have their webroot set
  # and leaves everything else as www... more flexible.
  set $li3root '';
  if (-f $document_root/webroot/index.php) { 
    set $li3root '/webroot';
  }
  
  # CHANGE THIS to where ever you want to keep your sites.
  # I recommend this if you're using brew on OS X.
  root /usr/local/sites/$sub/www$li3root; 

  # ENSURE sendfile IS OFF. IT'S A PIECE OF JUNK.
  # The idea is to optimize the sending of files, 
  # but it's causing more problems than it's worth.
  # Enable it if you want, but don't say I didn't warn ya.
  sendfile off;

  # I haven't seen the need, but it may be worth setting these higher.
  # client_max_body_size 24M;
  # client_body_buffer_size 128k;

  # error_page 404 errors/404.html;

  # UNCOMMENT TO ENABLE ACCESS LOGGING
  # again, you may need to adjust the path...
  # a few conditions for logging (it can be global or PER site)
  # set $access_log_path logs/access.log;
  # if (-d /usr/local/sites/$sub/logs) {
  #   set $access_log_path $sub/logs/access.log;  
  # }
  # access_log /usr/local/sites/$access_log_path;
   access_log off;

  # PHP ERROR LOG PATH IS SET AT /usr/local/etc/php/5.4/php-fpm.conf if using brew and php 5.4
  # Otherwise, check your php config.

  index index.php index.html index.htm;

  # for Lithium to work, /index.php?$args
  try_files $uri $uri/ /index.php?$args;
  
 # location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
 #   access_log off;
 #   expires max;
 # }
  
  location ~ \.php$ {
    fastcgi_intercept_errors on;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    # Again, you may need to change this path, it's based on a brew install.
    include /usr/local/etc/nginx/fastcgi_params;
  }
 
  location ~ /\.ht {
    deny  all;
  }
}

以上是关于ini 使用Homebrew的OS X的Nginx虚拟主机设置的主要内容,如果未能解决你的问题,请参考以下文章

Mac上Homebrew的使用——Homebrew 使 OS X 更完整

Mac OS X 包管理工具 Homebrew 安装与使用

使用 Homebrew 在 OS X 上更新 OpenSSL

sh 使用HomeBrew和所有库​​和支持在OS X上安装FFMPEG

sh 使用HomeBrew和所有库​​和支持在OS X上安装FFMPEG

mysql2 gem 无法在 OS X 上使用 Homebrew 编译 MySQL 5.6.12