Destramic Posted December 13, 2015 Share Posted December 13, 2015 hey guys, i'm trying to set up router so my local host can be visible to users...I've altered options in my router port forwarding but i'm unable to get it to work. i'm currently using nginx on my local host using port 8080 so i'm able to connect via: http://127.0.0.1:8080/ here are the options i've changed in my router: (port 21 for FTP 80 for nginx server) after there alterations i've tried to connect with my ip followed by the port (ip:80) and also http://192.168.1.1:80 but its not working. can anyone please give me advise on how i can get this working? thank you Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/ Share on other sites More sharing options...
gizmola Posted December 14, 2015 Share Posted December 14, 2015 First of all, are you sure your Web server is actually listening on it's LAN port? Localhost/127.0.0.1 is not the LAN port for your machine. It would be whatever the IP on 192.168.1.x is. I'm not sure what you need to do this for, but I'm going to give a plug to https://ngrok.com It's an alternative to what you're doing, that might be more flexible and convenient than screwing around with your router and opening up a port forward. Last but not least, you will not be able to easily test the port forward from your internal network. Only a machine outside your network can actually hit the router, so you'll need some way to test it other than trying to use a browser on the same machine, or some other machine at your house. Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1527890 Share on other sites More sharing options...
Solution requinix Posted December 14, 2015 Solution Share Posted December 14, 2015 1. The server has to be listening on your LAN IP address. 127.0.0.1 will only work for connections from the same computer. 2. Make sure your firewall allows inbound connections to that port. 3. Set up a port forwarding on your router from whatever port to your LAN IP address (and port). Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1527891 Share on other sites More sharing options...
Destramic Posted December 14, 2015 Author Share Posted December 14, 2015 I'm not sure what you need to do this for, but I'm going to give a plug to https://ngrok.com brilliant that worked like a charm....also very east to use and it broadcasted thanks gizmola ngork http 8080 requinix i'd like to know how to do it via my router also....here is what i've done. nginx operates on port 8080 locally...i've added a port forwarding on my router (port 80) for port 8080 (nginx) as seen in image above... i just added a rule in firewall for port 80 to be public, but i noticed there is a few other things that operate on port 80 in my firewall....so should i make it unique? here is my nginx conf...do i need to alter this too? worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { keepalive_timeout 300; proxy_read_timeout 300; proxy_connect_timeout 300; fastcgi_read_timeout 300; server { listen 8080; server_name 127.0.0.1; client_max_body_size 500M; index index.html index.htm index.php; root c:/nginx/html; location / { autoindex on; } location = /favicon.ico { log_not_found off; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; fastcgi_index index.php; fastcgi_read_timeout 300; } } } thank you for your help guys Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1527937 Share on other sites More sharing options...
requinix Posted December 14, 2015 Share Posted December 14, 2015 The nginx server needs to be listening on your LAN address too. As in 192.168.1.x. And the port for the firewall rule is the one that nginx uses. 8080. Your computer doesn't know anything about what the router is doing. i just added a rule in firewall for port 80 to be public, but i noticed there is a few other things that operate on port 80 in my firewall....so should i make it unique?What do you mean? What things? Make what unique? If there isn't already a rule set up for nginx then you'd need to make one: make a new firewall exception for a particular program (and find nginx.exe or whatever) so the rule doesn't grant access to everything, then allow access to port 8080 and any remote host. 1 Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1527939 Share on other sites More sharing options...
Destramic Posted December 15, 2015 Author Share Posted December 15, 2015 ok notes taken thank you. nginx config: listen 8080; server_name 192.168.1.80; i've made port 8080 as a new inbound rule on my firewall for nginx.exe and port 80 on my router forwarding to port 8080 now when i get someone to try connecting to my (ip):80 it doesn't connect...any ideas on this please requinix? i'm sure i've done everything right thank you Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1528010 Share on other sites More sharing options...
requinix Posted December 15, 2015 Share Posted December 15, 2015 I thought you were using ngrok? Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1528014 Share on other sites More sharing options...
Destramic Posted December 15, 2015 Author Share Posted December 15, 2015 I thought you were using ngrok? yeah i tried ngrok but would like to do it so my ip can be used as the web address....ngrok created a url like so: http://29749e5e.ngrok.io Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1528015 Share on other sites More sharing options...
requinix Posted December 15, 2015 Share Posted December 15, 2015 What if you turn off your firewall (temporarily)? Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1528016 Share on other sites More sharing options...
Destramic Posted December 17, 2015 Author Share Posted December 17, 2015 ok i turned off my windows firewall completely but im still getting no joy...if you could please help... here is the rule i did for my firewall opened port 8080 on my router followed by my nginx config containing 192.168.1.80 error_log logs/error.log; events { worker_connections 1024; } http { keepalive_timeout 300; proxy_read_timeout 300; proxy_connect_timeout 300; fastcgi_read_timeout 300; server { listen 8080; server_name 192.168.1.80; client_max_body_size 500M; index index.html index.htm index.php; root c:/nginx/html; location / { autoindex on; } location = /favicon.ico { log_not_found off; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; fastcgi_index index.php; fastcgi_read_timeout 300; } } } hope you can tell me where i've gone wrong? thank you Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1528136 Share on other sites More sharing options...
Destramic Posted December 19, 2015 Author Share Posted December 19, 2015 i changed all ports to 80 and i managed to get it to work perfectly now....thank you guys for your help Quote Link to comment https://forums.phpfreaks.com/topic/299728-users-accessing-my-localhost/#findComment-1528220 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.