Hello,
I’m interested in moving from Apache to nginx. What I’m doing with
Apache right now is serve files from multiple drives on windows. For
each drive I have a Directory entry in the httpd.conf and also an Alias
entry.
<Directory “e:/”>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
<Directory “k:/”>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Alias /c c:/
Alias /e e:/
Alias /k k:/
I’ve tried setting the root in the nginx config file to “C:” (without
the quotes), but then nginx won’t start. I will need to serve files
from drives C:, E: and K: at the same time for one server box.
Please let me know if there is a way to define multiple locations like
this.
Thanks,
Daniel
On Tue, Jun 16, 2009 at 09:13:54AM -0700, dwatrous wrote:
Allow from all
Alias /e e:/
Alias /k k:/
I’ve tried setting the root in the nginx config file to “C:” (without
the quotes), but then nginx won’t start. I will need to serve files
from drives C:, E: and K: at the same time for one server box.
Please let me know if there is a way to define multiple locations like
this.
location /c {
root c:/;
}
location /e {
root e:/;
}
location /k {
root k:/;
}
Thanks for the reply. This still isn’t working. Here is my entire
config file. As an initial test I’ve included only the C drive.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 50000;
server_name localhost;
location /c {
root c:/;
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
I’ve tried it with just C:/, with both C:/ and / as shown here and with
all drives. The / location will always load, but the others won’t.
Here’s what I get
http://localhost:50000/ produces “Welcome to nginx!” with the log file
showing:
127.0.0.1 - - [16/Jun/2009:11:58:05 -0600] “GET / HTTP/1.1” 304 0 “-”
“Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5”
127.0.0.1 - - [16/Jun/2009:11:58:05 -0600] “GET /favicon.ico HTTP/1.1”
404 169 “-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5”
http://localhost:50000/c and http://localhost:50000/c/ and
http://localhost:50000/c/index.html (so in other words attempting to
download a file I know is there) produce 404 errors and the following
log messages:
127.0.0.1 - - [16/Jun/2009:11:59:00 -0600] “GET /c HTTP/1.1” 404 169 “-”
“Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5”
127.0.0.1 - - [16/Jun/2009:11:59:07 -0600] “GET /c/ HTTP/1.1” 404 169
“-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5”
127.0.0.1 - - [16/Jun/2009:11:59:18 -0600] “GET /c/index.html HTTP/1.1”
404 169 “-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5”
I’ve tried the same thing in Firefox in addition to Chrome and observed
basically the same output of 404 errors.
What am I missing?
Thanks.
On Tue, Jun 16, 2009 at 11:01:00AM -0700, dwatrous wrote:
include mime.types;
}
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5"
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5"
What am I missing?
What is in error_log ?
On Wed, Jun 17, 2009 at 1:01 AM, dwatrous[email protected] wrote:
  include    mime.types;
  }
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5"
(KHTML, like Gecko) Chrome/2.0.172.31 Safari/530.5"
What am I missing?
Thanks.
try removing location / { … } block
dwatrous wrote:
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 50000;
server_name localhost;
location /c {
root c:/;
}
replace the location with
location /c {
alias c:/;
}
If I remember correctly a request for /c/foo.html with the root
directive in the location results in nginx looking for the file
“c:\c\foo.html”, and not “c:\foo.html”
This was discussed quite recently on the mailing list.
/PoJ
Works like a charm. Thank you so much.
I’ve tried all combinations, including leaving out the location /.
Is there some way to increase logging to get a better idea of what nginx
is trying to do? Can anyone else get it working with the config file
I’ve submitted?
Thanks.
On Wed, Jun 17, 2009 at 2:19 AM, Per Jonsson[email protected]
wrote:
      root  c:/;
This was discussed quite recently on the mailing list.
/PoJ
oh right, i completely forgot about this.
Well, there’s another solution if the partition is all ntfs: create a
folder which the subfolders are mount point for the drives.
(I personally find using alias is a headache when combined with fastcgi)