Winginx NginX

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
ShadowITAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Why do you have at the moment?
What is happening?
Is the firewall blocking it?
0
ShadowITAuthor Commented:
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
GaryCommented:
Can you attach your nginx.conf
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

ShadowITAuthor Commented:
Sure, I changed the file extension to .txt so I could upload it.
nginx.txt
0
GaryCommented:
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
ShadowITAuthor Commented:
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
GaryCommented:
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
ShadowITAuthor Commented:
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
GaryCommented:
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
ShadowITAuthor Commented:
Internet Explorer cannot display the webpage
0
ShadowITAuthor Commented:
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
GaryCommented:
It's connecting but no default page found which you have set as
index index.php index.html;
0
ShadowITAuthor Commented:
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
GaryCommented:
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
ShadowITAuthor Commented:
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
GaryCommented:
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
ShadowITAuthor Commented:
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
GaryCommented:
Can you do an hard refresh in the browser, just to make sure its not cached.
0
ShadowITAuthor Commented:
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
GaryCommented:
Can you load the site appending index.php (or whatever is your default index)
0
ShadowITAuthor Commented:
no, I tried the index.php and also index.html they both get the 404 error
0
GaryCommented:
Can you attach your whole nginx.conf again.
0
ShadowITAuthor Commented:
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
ShadowITAuthor Commented:
Sure, here you go...
nginx.txt
0
GaryCommented:
You have localhost set
listen   127.0.0.1:80;
0
ShadowITAuthor Commented:
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
GaryCommented:
Just remove the ip so you have

listen  80;

It should still work locally
0
ShadowITAuthor Commented:
I've done as you've requested and it still does open locally.
0
GaryCommented:
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
ShadowITAuthor Commented:
Did "hello world" and it works fine locally when I open localhost in IE9 browser.
0
GaryCommented:
And still a 404 from elsewhere on the network?
0
ShadowITAuthor Commented:
yes, damn this is frustrating...
0
GaryCommented:
Thinking...
0
ShadowITAuthor Commented:
me too...but I just keep coming up with the same answers, this should work.
0
GaryCommented:
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
ShadowITAuthor Commented:
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
GaryCommented:
WAMP or XAMPP (prefer XAMPP)
I will have a further ponder.
0
Puspharaj SelvarajSr.System engineerCommented:
Can you run a trace route command from the internal network to see what happens ?

traceroute ip_address_of_the_server
0
ShadowITAuthor Commented:
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
RobOwner (Aidellio)Commented:
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
RobOwner (Aidellio)Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShadowITAuthor Commented:
OK, now why exactly did this work?  But really I am just glad that it did, thank you.
0
RobOwner (Aidellio)Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.