Forum: NGINX Windows | Nginx Mapped Hard Drive | Network Sharing

Db4adb0ef6b1521ccd8c32f94efa1b6a?d=identicon&s=25 C0nw0nk W0nky (Guest)
on 2014-04-04 22:31
(Received via mailing list)
http://stackoverflow.com/questions/22870814/nginx-...

So i tried sharing my hard drives on windows and serving the content on
them from nginx but nginx returns a 404 not found error every time.
1d7e58690643fef4a92750ff39f4c56c?d=identicon&s=25 Kevin Worthington (Guest)
on 2014-04-04 22:48
(Received via mailing list)
Answered your question here:
http://stackoverflow.com/questions/22870814/nginx-...


Best regards,
Kevin
--
Kevin Worthington
kworthington@gmail.com
http://kevinworthington.com/
http://twitter.com/kworthington
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-04 22:59
(Received via mailing list)
Apart from Kevin's answer, if you are running nginx as a service that
service must map the drive letter and then start nginx.
When you map a drive as a user the service running nginx does not have
access to that user-mapped drive.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249011#msg-249011
Db4adb0ef6b1521ccd8c32f94efa1b6a?d=identicon&s=25 C0nw0nk W0nky (Guest)
on 2014-04-05 00:02
(Received via mailing list)
Thanks for the response i posted my config and tried you way but still
no luck nginx delivers dynamic content fine but as for the static
content that it should be delivering from the mapped hard drive it just
keeps saying 404 not found.
Date: Fri, 4 Apr 2014 16:47:55 -0400
Subject: Re: Windows | Nginx Mapped Hard Drive | Network Sharing
From: kworthington@gmail.com
To: nginx@nginx.org

Answered your question here:
http://stackoverflow.com/questions/22870814/nginx-...


Best regards,
Kevin
--
Kevin Worthington
kworthington@gmail.com
http://kevinworthington.com/

http://twitter.com/kworthington


On Fri, Apr 4, 2014 at 4:30 PM, C0nw0nk W0nky <c0nw0nk@hotmail.co.uk>
wrote:




http://stackoverflow.com/questions/22870814/nginx-...


So i tried sharing my hard drives on windows and serving the content on
them from nginx but nginx returns a 404 not found error every time.


_______________________________________________

nginx mailing list

nginx@nginx.org

http://mailman.nginx.org/mailman/listinfo/nginx
1d7e58690643fef4a92750ff39f4c56c?d=identicon&s=25 Kevin Worthington (Guest)
on 2014-04-05 00:09
(Received via mailing list)
Replied on SO. Mirroring here:

Try removing the root and index blocks from the server block. Leave it
only in the location block.

--
Kevin Worthington
kworthington@gmail.com
http://kevinworthington.com/
http://twitter.com/kworthington
Db4adb0ef6b1521ccd8c32f94efa1b6a?d=identicon&s=25 C0nw0nk W0nky (Guest)
on 2014-04-05 00:14
(Received via mailing list)
Same issue removed it from the server block i don't think nginx is
compatible with windows network sharing.

Subject: Re: Windows | Nginx Mapped Hard Drive | Network Sharing
From: kworthington@gmail.com
Date: Fri, 4 Apr 2014 18:08:44 -0400
To: nginx@nginx.org

Replied on SO. Mirroring here:
Try removing the root and index blocks from the server block. Leave it
only in the location block.

--Kevin
Worthingtonkworthington@gmail.comhttp://kevinworthington.com/http://twitter.com/kworthington
On Apr 4, 2014, at 6:01 PM, C0nw0nk W0nky <c0nw0nk@hotmail.co.uk> wrote:





Thanks for the response i posted my config and tried you way but still
no luck nginx delivers dynamic content fine but as for the static
content that it should be delivering from the mapped hard drive it just
keeps saying 404 not found.
Date: Fri, 4 Apr 2014 16:47:55 -0400
Subject: Re: Windows | Nginx Mapped Hard Drive | Network Sharing
From: kworthington@gmail.com
To: nginx@nginx.org

Answered your question here:
http://stackoverflow.com/questions/22870814/nginx-...


Best regards,
Kevin
--
Kevin Worthington
kworthington@gmail.com
http://kevinworthington.com/

http://twitter.com/kworthington


On Fri, Apr 4, 2014 at 4:30 PM, C0nw0nk W0nky <c0nw0nk@hotmail.co.uk>
wrote:




http://stackoverflow.com/questions/22870814/nginx-...


So i tried sharing my hard drives on windows and serving the content on
them from nginx but nginx returns a 404 not found error every time.


_______________________________________________

nginx mailing list

nginx@nginx.org

http://mailman.nginx.org/mailman/listinfo/nginx



_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-05 00:33
(Received via mailing list)
c0nw0nk Wrote:
-------------------------------------------------------
> Same issue removed it from the server block i don't think nginx is
> compatible with windows network sharing.

It is compatible and works perfectly when done properly, post conf and
describe how drives are mapped and in which context nginx is running.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249016#msg-249016
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 00:38
(Received via mailing list)
Here is my config.

server {
    listen  80;
    listen  [::]:80;
    server_name  domain.com www.domain.com;

    root   z:/server/websites/ps/public_www;
    index index.php index.html index.htm default.html default.htm;
    location / {
    root   z:/server/websites/ps/public_www;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass   http://127.0.0.1:8000;
    expires 3s;
    max_ranges 0;
    }
    location ~ \.flv$ {
    flv;
    limit_rate 200k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~ \.mp4$ {
    limit_rate 200k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~ \.gif$ {
    limit_rate 50k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~* \.(avi|m4v|mov|divx|webm|ogg|mp3|mpeg|mpg|zip|rar)$ {
    limit_rate 90k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~*
\.(ico|png|jpg|jpeg|gif|flv|mp4|avi|m4v|mov|divx|webm|ogg|mp3|mpeg|mpg|swf|css|js|txt|zip|rar|xml)$
{
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
    return 404;
    }
    location ~
^/(xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info|cpanel|configuration.php)
{
    return 404;
    }
}

For my machine running nginx connecting to my mapped hard drive. The
hard
drive name is Z:/

I Have apache running on port 8000 for php and html files only serving
static content. All dynamic content is served by nginx. But when i go to
access a nginx file i get given a 404 not found error.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249017#msg-249017
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 00:40
(Received via mailing list)
Sorry made a mistake and can't edit my previous post. Nginx handles all
static content and Apache handles all dynamic content.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249018#msg-249018
1d7e58690643fef4a92750ff39f4c56c?d=identicon&s=25 Kevin Worthington (Guest)
on 2014-04-05 00:56
(Received via mailing list)
Try:

server {
    listen  80;
    listen  [::]:80;
    server_name  domain.com www.domain.com;

    # removed lines here...

    location / {
    root   z:/server/websites/ps/public_www;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass   http://127.0.0.1:8000;
    expires 3s;
    max_ranges 0;
    }
    location ~ \.flv$ {
    flv;
    limit_rate 200k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~ \.mp4$ {
    limit_rate 200k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~ \.gif$ {
    limit_rate 50k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~* \.(avi|m4v|mov|divx|webm|ogg|mp3|mpeg|mpg|zip|rar)$ {
    limit_rate 90k;
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    location ~*
\.(ico|png|jpg|jpeg|gif|flv|mp4|avi|m4v|mov|divx|webm|ogg|
mp3|mpeg|mpg|swf|css|js|txt|zip|rar|xml)$
{
    root   z:/server/websites/ps/public_www;
    expires max;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
    return 404;
    }
    location ~
^/(xampp|security|phpmyadmin|licenses|webalizer|server-
status|server-info|cpanel|configuration.php)
{
    return 404;
    }
}

Best regards,
Kevin
--
Kevin Worthington
kworthington@gmail.com
http://kevinworthington.com/
http://twitter.com/kworthington
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 00:57
(Received via mailing list)
Also if it helps my current version of nginx is 1.5.12

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249019#msg-249019
1d7e58690643fef4a92750ff39f4c56c?d=identicon&s=25 Kevin Worthington (Guest)
on 2014-04-05 00:58
(Received via mailing list)
I tested it earlier with 1.5.12...

Best regards,
Kevin
--
Kevin Worthington
kworthington@gmail.com
http://kevinworthington.com/
http://twitter.com/kworthington
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-05 01:00
(Received via mailing list)
I did a simple config:

server {
listen 80;
server_name localhost;

root Y:/www.mydomain.nl;
index index.php index.html index.htm default.html default.htm;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
#proxy_pass http://127.0.0.1:8000;
expires 3s;
max_ranges 0;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
return 404;
}
location ~
^/(xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info|cpanel|configuration.php)
{
return 404;
}
}

And accessed http://localhost/Disclaimer.txt
which works perfectly, your config is not optimal but the share works as
it
suppose to.
so its definitely a config issue and not a share issue.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249021#msg-249021
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 01:00
(Received via mailing list)
Yep that is my current config and i still recieve a 404 error accessing
my
static files jpg, mp4, flv etc.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249023#msg-249023
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 01:14
(Received via mailing list)
I think it is a nginx issue it works fine on the localhost and i have
full
read write and execute access to that hard drive via my remote machine
even
browsing it and confirm the files exsist nginx keeps saying 404 not
found.

I think its a bug.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249025#msg-249025
Db4adb0ef6b1521ccd8c32f94efa1b6a?d=identicon&s=25 C0nw0nk W0nky (Guest)
on 2014-04-05 01:27
(Received via mailing list)
Try it with a mp4,flv,jpg file. Not documents that have a plain text
mime type.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-05 13:05
(Received via mailing list)
c0nw0nk Wrote:
-------------------------------------------------------
> Try it with a mp4,flv,jpg file. Not documents that have a plain text
> mime type.

127.0.0.1 - - [05/Apr/2014:12:58:46 +0200] "GET /29092007003.mp4
HTTP/1.1"
200 245770434 "-" "Mozilla/5.0 (Windows NT CISNSA; Win32; x86)
Gecko/20100101 Firefox/28.0"

Also works fine as expected.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249031#msg-249031
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 18:59
(Received via mailing list)
http://i633.photobucket.com/albums/uu52/C0nw0nk/Un...

If you look at that picturei think that is why i have a 404 error.
Because
when i first connect to the drive all works fine i can access the media,
Then i restart nginx and it says 404 not found.

What is the file path to delete the caches of the windows file shares.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249034#msg-249034
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-05 19:16
(Received via mailing list)
c0nw0nk Wrote:
-------------------------------------------------------
> Because when i first connect to the drive all works fine i can access
> the media, Then i restart nginx and it says 404 not found.
>
> What is the file path to delete the caches of the windows file shares.

There is no cache as such, shares can get in a disconnect state (the
infamous red cross), see http://support.microsoft.com/kb/297684

The best way to access shared media is via its UNC, ea.
\\192.168.1.10\sharename\media and have guest access enabled.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249035#msg-249035
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-05 19:35
(Received via mailing list)
Thanks for the information and sorry for making so many posts and such a
fuss over it. I think i may have found the true culprit behind this
silly
error.

In my Http server section of my nginx config i had this.

#open_file_cache          max=900000 inactive=10m;
#open_file_cache_valid    20m;
#open_file_cache_min_uses 1;
#open_file_cache_errors   on;

I nulled out my open file cache and what do you know i can restart nginx
as
much as i like and no issues. :)

So it is open_file_cache that is incompatible with the network sharing
feature on windows.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249036#msg-249036
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-05 21:23
(Received via mailing list)
c0nw0nk Wrote:
-------------------------------------------------------
> I nulled out my open file cache and what do you know i can restart
> nginx as much as i like and no issues. :)
>
> So it is open_file_cache that is incompatible with the network sharing
> feature on windows.

It all depends what kind of host the sharing is done from, for instance
here
we use Debian(vm) as storage concentrator, nginx connects to Debian and
Debian connects and handles unlimited storage units creating a big pool,
and
we use open_file_cache without issues.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249039#msg-249039
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-06 18:31
(Received via mailing list)
I also did use the Microsoft fix it that you posted itpp2012 so as of
what
actually fixed it i think it was probably the Microsoft option but i
don't
need the file cache anyway.

Thanks for all the help much appreciated.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249047#msg-249047
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-07 00:09
(Received via mailing list)
After doing some more testing there is one way it does not work still.
When
Nginx runs on windows it runs under your user account. For example my
account name is root.

So it says nginx is running under the root user.
But when i restart the server(local machine) it says nginx is running
under
the SYSTEM user and that is when all files other than plain text give of
a
404 not found error.

Its a interesting issue maybe the SYSTEM user group in windows does not
have
access to the mapped hard drives ?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249049#msg-249049
1266aa99d1601b47bbd3ec22affbb81c?d=identicon&s=25 B.R. (Guest)
on 2014-04-07 02:43
(Received via mailing list)
I have little knowledge about Windows, but I know that the SYSTEM
account
is usually related to processes running as services.

SYSTEM has restricted rights on number of things, despite appearing as a
'super-account', an attempt from Windows to mitigate services
'super-powers'.
It would not surprise me if SYSTEM was not authorized to access mapped
drives.

Try changing the user executing the service or try running nginx as a
normal user process.
---
*B. R.*
2974d09ac2541e892966b762aad84943?d=identicon&s=25 itpp2012 (Guest)
on 2014-04-07 09:25
(Received via mailing list)
c0nw0nk Wrote:
> Its a interesting issue maybe the SYSTEM user group in windows does
> not have access to the mapped hard drives ?

This is default behavior, ea:
http://stackoverflow.com/questions/13178892/access...
http://stackoverflow.com/questions/659013/accessin...

OTOH, never run any service as SYSTEM if there is no need for it, always
create a user for a service and limits its rights (jail it).

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249053#msg-249053
2974d09ac2541e892966b762aad84943?d=identicon&s=25 c0nw0nk (Guest)
on 2014-04-07 19:02
(Received via mailing list)
So does anyone know how to edit the SYSTEM account privileges if not i
have
a way around it anyway.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,249008,249082#msg-249082
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.