nginx的設定 - Linux

By Edward Lewis
at 2014-12-17T19:13
at 2014-12-17T19:13
Table of Contents
以下是我nginx的設定
我想要做成一台機器上有兩個不同的網站
然後靠url第一層的path去區分
以下例來說就是 127.0.0.1/kaoru 與 127.0.0.1/test 分別是兩個不同的站台
但我現在遇到的問題是網站開起來了但是 assets 裡頭的東西都無法存取,所以js與css都
不能用
我分別建立兩個靜態檔案 public/1.html 與 public/assets/2.html
發現 127.0.0.1/kaoru/1.html 是可以正常讀取的
但是 127.0.0.1/kaoru/assets/2.html 會回傳 404
權限設定沒有問題
請問還有那裏沒有做對嗎
版本是
nginx version: nginx/1.6.2
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --with-http_ssl_module
--with-http_gzip_static_module --with-http_stub_status_module
--with-cc-opt=-Wno-error
--add-module=/usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.55/ext/nginx
nginx的設定如下
worker_processes 3;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.55;
passenger_ruby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location ~ ^/kaoru(/.|$) {
alias /var/kaoru_home/public$1;
passenger_base_uri /kaoru;
passenger_app_root /var/kaoru_home;
passenger_document_root /var/kaoru_home/public;
passenger_enabled on;
}
location /test {
passenger_base_uri /test;
alias /var/www;
}
}
}
--
Tags:
Linux
All Comments

By Jessica
at 2014-12-20T14:10
at 2014-12-20T14:10

By Franklin
at 2014-12-24T16:06
at 2014-12-24T16:06

By Ingrid
at 2014-12-26T21:34
at 2014-12-26T21:34
Related Posts
Win 8 Ubuntu 雙系統問題

By Belly
at 2014-12-17T11:20
at 2014-12-17T11:20
CentOS安裝jmgaick問題

By David
at 2014-12-16T20:14
at 2014-12-16T20:14
學習嵌入式Linux需要上課嗎?

By Gilbert
at 2014-12-16T09:13
at 2014-12-16T09:13
WIN7 Ubuntu 14.04 的開機選單

By Daph Bay
at 2014-12-15T18:08
at 2014-12-15T18:08
Git教學文件

By Tom
at 2014-12-15T15:57
at 2014-12-15T15:57