LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-10-2016, 01:00 AM   #1
kwatts59
Member
 
Registered: Aug 2012
Posts: 34

Rep: Reputation: Disabled
I can only access file in /var/www/html from home network


Hi everybody,
I put a file in the /var/www/html directory called pcie-bus-error.jpg.

When I go to firefox and type in http://192.168.0.15/pcie-bus-error.jpg into the address bar, I see the image.

When I try to access it from my samsung cell using 4G LTE, it says "The webpage is not available". When I set my cell to connect to the local network via Wifi, it works.

It appears that only my network can view this image.

How do I make it so everybody can see the image?
Thanks in advance,
Ken
 
Old 09-10-2016, 01:27 AM   #2
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Quote:
Originally Posted by kwatts59 View Post
Hi everybody,
I put a file in the /var/www/html directory called pcie-bus-error.jpg.

When I go to firefox and type in http://192.168.0.15/pcie-bus-error.jpg into the address bar, I see the image.

When I try to access it from my samsung cell using 4G LTE, it says "The webpage is not available". When I set my cell to connect to the local network via Wifi, it works.

It appears that only my network can view this image.

How do I make it so everybody can see the image?
Thanks in advance,
Ken
The address "192.168.0.15" will only be valid within the same LAN as that computer. In order to make this web page accessible to the outside world, you need to:

1) Find out your outside world IP address. One way to do this is to google "What is my ip address?"

2) Configure your router to port forward requests for port 80 (http) to 192.168.0.15
The way to do this varies by router brand. In any case, you will need administrator rights to the router. Assuming this is your home network, you probably set up the router yourself. Even if you have forgotten the router admin password, you can do a factory reset to return everything to defaults. (You'll then need to completely set up your LAN customizations.)

3) After doing this, replacing "192.168.0.15" in the url with your outside world IP address should work.

But it probably won't work. Why? Because your Internet Service Provider probably blocks port 80. Sucks, but that's the way it is. So, you'll have to configure your web server to use listen to a custom port also. Assuming you are using Apache, you edit /etc/apache2/ports.conf and make it look something like this:

Code:
Listen 80
Listen 8080
Listen 8888

<IfModule ssl_module>
Listen 443
</IfModule>
At that point, restart Apache and make sure http://192.168.0.15:8888/pcie-bus-error.jpg works within your LAN.
Then configure your router to forward ports 8080 and 8888 to 192.168.0.15.

Chances are, your ISP will allow port 8080 or 8888.
 
Old 09-10-2016, 05:32 PM   #3
kwatts59
Member
 
Registered: Aug 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Thanks for the quick reply.
I am running Fedora 24 server and there is no /etc/apache2.
However, there is a /etc/httpd/conf/httpd.conf file and there is a line in it that says
Code:
Listen 80
Is this the file I should be changing?
 
Old 09-10-2016, 06:49 PM   #4
kwatts59
Member
 
Registered: Aug 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Update!
I set up my Netgear router to port forward ports 80, 8080 and 8888. See picture below:
http://131.216.46.121/port_forward.png

I modified the /etc/httpd/conf/httpd.conf file so that it says
Code:
Listen 80
Listen 8080
Listen 8888
But when I restart the httpd service
Code:
systemctl restart httpd
I get the following errors:
Code:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
When I remove the line "Listen 8888" and restart the httpd service, it starts fine.

When I try accessing http://192.168.0.15/pcie-bus-error.jpg , I still get "This webpage is not available" error.
Any help would be appreciated.
Thanks in advance.
 
Old 09-10-2016, 06:53 PM   #5
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
There may be a problem with port 8888 because Fedora by default blocks it or something. I don't know Fedora well.

Anyway, adding port 8080 seemed to work okay, so the next step is to try the url:

http://xxx.xxx.xxx.xxx:8080/pcei-bus-error.jpg

Replace xxx.xxx.xxx.xxx with your outside world ip address. This will be different from 192.168.0.15. You can find out your outside world IP address by googling, "What is my IP address?"
 
Old 09-10-2016, 11:49 PM   #6
kwatts59
Member
 
Registered: Aug 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
I tried http://192.168.0.15:8080/pcie-bus-error.jpg . It works from within my network but it still does not work outside my network. (P.S. Please feel free to click on the link and see if it works.)

I also entered the following command to add port 8080 to the firewall
Code:
firewall-cmd --permanent --add-port=8080/tcp
I restarted httpd (systemctl restart httpd) and tried it again and it still did not work.
Any help would be appreciated.

Last edited by kwatts59; 09-11-2016 at 12:01 AM.
 
Old 09-11-2016, 04:25 AM   #7
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 8 Jessie
Posts: 1,688
Blog Entries: 5

Rep: Reputation: 163Reputation: 163
Please look up your outside world IP address by googling "What is my ip address?"

As I have said already, 192.168.0.15 will ONLY WORK ON YOUR LAN.

You MUST look up your outside world IP address.

It's very simple.

Go to http://www.google.com/

Type in the search bar, "What is my ip address?"

Your outside world IP address will appear near the top of the search results page.

Then, the URL

http://xxx.xxx.xxx.xxx:8080/pcie-bus-error.jpg will work. You MUST replace xxx.xxx.xxx.xxx with your OUTSIDE WORLD IP ADDRESS.

You will NEVER get 192.168.0.15 to work outside your LAN.

You MUST use a URL with a different IP address outside your LAN. The only one which will work is the outside world address of your LAN's gateway.
 
1 members found this post helpful.
Old 09-11-2016, 03:13 PM   #8
kwatts59
Member
 
Registered: Aug 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
I logged into my server and started Firefox and googled "what is my ip address". Below are the results:
ipv4: 68.224.106.197
ipv6: 2600:8801:3604:d000:1a66:daff:fe22:e310

http://68.224.106.197:8080/pcie-bus-error.jpg
http://68.224.106.197/pcie-bus-error.jpg
http://[2600:8801:3604:d000:1a66:daf...-bus-error.jpg
http://[2600:8801:3604:d000:1a66:daf...-bus-error.jpg

I tried the above links and they do not work from outside my local network.

Feel free to click on the links yourself.
Any suggestions would be appreciated.

P.S. The links work from within my network.
 
Old 09-11-2016, 03:21 PM   #9
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Your server is seen http://68.224.106.197:8080/
 
Old 09-11-2016, 03:25 PM   #10
kwatts59
Member
 
Registered: Aug 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Yay!!! Success!!!
Thanks everybody for your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the best way of enabling non-root access to /var/www/html? AdultFoundry Linux - Newbie 8 11-02-2015 05:14 PM
[SOLVED] Create a New User with home dir set to /var/www/html/? wh33t Ubuntu 4 07-16-2015 03:50 AM
ftp access to /var/www/html bmccarty12 Linux - General 2 10-16-2009 01:21 PM
Configure /var/www/html for user write access? SlowCoder Linux - Server 9 07-26-2009 06:37 PM
FTP access to /var/www/html/web_folder jonaskellens Linux - Server 2 07-11-2009 09:23 AM


All times are GMT -5. The time now is 10:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration