Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Winginx NginX

Posted on 2014-03-04
47
Medium Priority
?
1,042 Views
Last Modified: 2014-05-02
Hello Experts,

I am currently using Winginx for some internal development and I want to listen to a specific ip address other than localhost (127.0.0.1) to the actual ip address of the server so that it can be accessed across our intranet for testing purposes.

I've tried to configure the nginx.conf to listen to the server's ip address but that didn't work.  

Any help would be greatly appreciated.

Thanks
0
Comment
Question by:ShadowIT
  • 21
  • 18
  • 3
  • +1
47 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39906519
Why do you have at the moment?
What is happening?
Is the firewall blocking it?
0
 

Author Comment

by:ShadowIT
ID: 39906537
Why do you have at the moment?  I don't understand this question.
What is happening? When I enter the server's ip address it doesn't work
Is the firewall blocking it? I made just the firewall allows nginx web server.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906549
Can you attach your nginx.conf
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 

Author Comment

by:ShadowIT
ID: 39906629
Sure, I changed the file extension to .txt so I could upload it.
nginx.txt
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906652
I don't see any config other than for 127.0.0.1
All you need to is copy the server block and change the IP
Once you've done that, restart Nginx and let me know if you get any error messages.
0
 

Author Comment

by:ShadowIT
ID: 39906668
This is my point, I tried that and it didn't work so I changed it back to 127.0.0.1 to allow localhost to work again.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906688
Well that is all you need to do.
Are you sure you are editing the correct file.
As long as you are not getting any errors restarting nginx then the problem lies elsewhere.
Can you ping the servers IP from another pc?
0
 

Author Comment

by:ShadowIT
ID: 39906719
Are you sure you are editing the correct file. (Gary) Not really, I am not that familiar using NginX.  I've used Apache and IIS but I am having a try at NginX but this seems to be the correct conf file.

As long as you are not getting any errors restarting nginx then the problem lies elsewhere. (Gary) After I add the server's ip address I restart all the services and don't get an error.  It seems fine and I don't see anything obvious.  I thought maybe there was something else that needed to be maintained for NginX

Can you ping the servers IP from another pc? (Gary) Yes so long at the client pinging it either on the network or behind the firewall via VPN.  Which is what I want and would expect.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906730
And what do you get when accessing the IP through the browser from another pc?

Remove the IP from the server block just leaving the port.
listen       80;

Let me just double check if there are any specific settings for Winginx, I use nginx and as far as I know the config is the same.
0
 

Author Comment

by:ShadowIT
ID: 39906745
Internet Explorer cannot display the webpage
0
 

Author Comment

by:ShadowIT
ID: 39906773
Wait, I misspoke....when I try and access it I get

"404 Not Found

--------------------------------------------------------------------------------

nginx/1.4.5"

So it seems to be trying to connect.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906785
It's connecting but no default page found which you have set as
index index.php index.html;
0
 

Author Comment

by:ShadowIT
ID: 39906826
Well is that a normal config?  Is it supposed to be index index.php index.html;?  What I mean is when I have this set to 127.0.0.1 for localhost it seems to work fine then when I change this to my server's ip address I get the error 404.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906844
Can you post your server block
Did you remove the IP leaving just the Port? If so can you still access the site locally.
0
 

Author Comment

by:ShadowIT
ID: 39906900
server {
 
    listen 164.145.158.122:80;
    server_name 164.145.158.122;
 
    # other instructions
 
}

Yes, I did remove the ip address just leaving the port and I was able to access the site locally.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39906961
Change your listen/server name to this

   listen 80 default_server;
    server_name _;


I cannot think of a reason why you would be getting a 404 if it works locally.
0
 

Author Comment

by:ShadowIT
ID: 39906994
ok, I changed it to:

server {
 
    listen 80 default_server;
    server_name _;
 
}

And when I tried to access the site locally it works, but when I tried from a client I get the same error 404.

404 Not Found

nginx/1.4.5
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907002
Can you do an hard refresh in the browser, just to make sure its not cached.
0
 

Author Comment

by:ShadowIT
ID: 39907043
I did that and I also tried to open it using Firefox which I haven't used previously, same error:

404 Not Found

nginx/1.4.5
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907058
Can you load the site appending index.php (or whatever is your default index)
0
 

Author Comment

by:ShadowIT
ID: 39907067
no, I tried the index.php and also index.html they both get the 404 error
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907073
Can you attach your whole nginx.conf again.
0
 

Author Comment

by:ShadowIT
ID: 39907083
I should mention that when I tried localhost locally I get:

It works!

Welcome to Winginx!

but it I try localhost/index.php or localhost/index.html I get the error 404.  it would seem that

It works!

Welcome to Winginx!

is the index message.
0
 

Author Comment

by:ShadowIT
ID: 39907095
Sure, here you go...
nginx.txt
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907103
You have localhost set
listen   127.0.0.1:80;
0
 

Author Comment

by:ShadowIT
ID: 39907111
Yes, I know...if I leave it as the server's ip address it doesn't work locally so I have to change it back to 127.0.0.1:80;
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907124
Just remove the ip so you have

listen  80;

It should still work locally
0
 

Author Comment

by:ShadowIT
ID: 39907179
I've done as you've requested and it still does open locally.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907186
Can you verify that this is your document root
home/localhost/public_html
In that folder add your own index file, something simple like Hello world and verify it is opening in the browser.
0
 

Author Comment

by:ShadowIT
ID: 39907248
Did "hello world" and it works fine locally when I open localhost in IE9 browser.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907265
And still a 404 from elsewhere on the network?
0
 

Author Comment

by:ShadowIT
ID: 39907284
yes, damn this is frustrating...
0
 
LVL 58

Expert Comment

by:Gary
ID: 39907625
Thinking...
0
 

Author Comment

by:ShadowIT
ID: 39907716
me too...but I just keep coming up with the same answers, this should work.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39913264
Can you check permissions on the folder/files and set them to everyone.
All I can think of is that this is some kind of permission problem, tho it doesn't make sense.
0
 

Author Comment

by:ShadowIT
ID: 39913487
Well I added Everyone to the top level folder within C:\Winginx just to ensure it was completely open and I am still getting error 404 if I try to access the web server using a client.  For that matter if I try to use the server's ip address locally I also get the error 404 and it seems to only work when I use localhost.  I rechecked the firewall and it does include the Winginx app for both TCP and UDP so I am at a complete loss as to why this isn't working.

What I was looking for when I first selected Winginx was an all-in-one application that contained MySQL, PHP and NginX so perhaps you could recommend something and I will just install that and forget about Winginx.  I'm just looking for something so I can easily config all of these apps together.
0
 
LVL 58

Expert Comment

by:Gary
ID: 39913498
WAMP or XAMPP (prefer XAMPP)
I will have a further ponder.
0
 
LVL 2

Expert Comment

by:Puspharaj Selvaraj
ID: 39982479
Can you run a trace route command from the internal network to see what happens ?

traceroute ip_address_of_the_server
0
 

Author Comment

by:ShadowIT
ID: 40003293
My apologizes for the delayed response, when I ran tracert is resolved with the following:

Tracing route to TX92DT8LDNBZ1.global.ds.honeywell.com [164.145.158.122]
over a maximum of 30 hops:

  1    <1 ms    <1 ms    <1 ms  TX92DT8LDNBZ1.global.ds.honeywell.com [164.145.1
58.122]

Trace complete.
0
 
LVL 43

Expert Comment

by:Rob
ID: 40030849
Not sure if it helps but a 404 is served by the server so your network clients are connecting.
I suspect it's similar to connecting to MySQL remotely as you have to give specific permissions for the public server IP address to access from anywhere other than localhost.
0
 
LVL 43

Accepted Solution

by:
Rob earned 2000 total points
ID: 40030853
if (!-e $document_root$document_uri){return 404;}

Open in new window


comment out that line as it's most likely causing your issue
0
 

Author Closing Comment

by:ShadowIT
ID: 40035440
OK, now why exactly did this work?  But really I am just glad that it did, thank you.
0
 
LVL 43

Expert Comment

by:Rob
ID: 40036757
It works because commenting it out ignores the url rewrite or some form of it that is unique to NginX.
It could be a mechanism for blocking anything other than from localhost I'm not sure. Best thing would be to find those variables in the documentation somewhere and how they're used in the config file etc
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question