| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
Due to network maintenance being performed by our provider, LQ will be down starting at 05:01 AM UTC. The exact duration of the downtime isn't currently known. We apologize for the inconvenience.
|
 |
10-29-2011, 12:40 PM
|
#1
|
|
Member
Registered: Oct 2011
Posts: 160
Rep:
|
Web Browser Accessing Files On Different PC on Network
I have installed Ubuntu 11.04 on one PC and Ubuntu 11.10 on another. I have installed LAMP on both. I know the IP address of the 11.10 PC and can ping between both PCs w/o another problems. I would like PHP files on the .04 PC to be able to call PHP files on the .10 PC. However none of the following work. (X is an integer in the IP address.)
Code:
file:////198.162.1.X/var/www/index.php
Code:
/198.162.1.X/var/www/index.php
index.php is in the /var/www directory on the .10 PC but FireFox keeps giving me "File not found".
Any assistance with this would be greatly appreciated.
Peter.
|
|
|
|
10-29-2011, 01:56 PM
|
#2
|
|
Member
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 538
Rep:
|
I believe the file: protocol only works for files on the local machine. To access files on another machine, you need to install a web server, like apache, lighttpd, thttpd or boa.
The index.php would be put at the path indicated by the DocumentRoot parameter in apache's httpd.conf configuration file, or similar configuration for other servers. Then you would access it like this:
http://198.162.1.X/index.php
or just
http://198.162.1.X/
|
|
|
|
10-29-2011, 03:38 PM
|
#3
|
|
Member
Registered: Oct 2011
Posts: 160
Original Poster
Rep:
|
Quote:
Originally Posted by KenJackson
I believe the file: protocol only works for files on the local machine. To access files on another machine, you need to install a web server, like apache, lighttpd, thttpd or boa.
The index.php would be put at the path indicated by the DocumentRoot parameter in apache's httpd.conf configuration file, or similar configuration for other servers. Then you would access it like this:
http://198.162.1.X/index.php
or just
http://198.162.1.X/
|
Thank you for your reply. I have Apache set up on both PCs as it is part of LAMP. I had to set up Apache first. I found that /etc/apache2/httpd.conf is empty but, when I enter
Code:
http://localhost/index.php
on a given PC, it uses index.php which is in the /var/www/ directory of that PC. Sam with any other .php file.
I tried
http://198.162.1.X/index.php
and
http://198.162.1.X/
it tries for several minutes to connect and then times out.
Thanks,
Peter.
|
|
|
|
10-29-2011, 11:00 PM
|
#4
|
|
Member
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 538
Rep:
|
It's odd that httpd.conf would be empty, though maybe there are enough defaults for it to work.
I would first make sure that iptables is not blocking incoming requests. This command will flush all the input rules (until you reboot or reload the rules):
Code:
sudo iptables -F INPUT
You can verify the server is listening with this command, which should give a response something like this.
Code:
netstat -l | grep http
tcp 0 0 *:http *:* LISTEN
Also be sure to look for clues in /var/log/httpd/error_log.
|
|
|
|
10-29-2011, 11:14 PM
|
#5
|
|
Member
Registered: Oct 2011
Posts: 160
Original Poster
Rep:
|
Quote:
Originally Posted by KenJackson
It's odd that httpd.conf would be empty, though maybe there are enough defaults for it to work.
I would first make sure that iptables is not blocking incoming requests. This command will flush all the input rules (until you reboot or reload the rules):
Code:
sudo iptables -F INPUT
You can verify the server is listening with this command, which should give a response something like this.
Code:
netstat -l | grep http
tcp 0 0 *:http *:* LISTEN
Also be sure to look for clues in /var/log/httpd/error_log.
|
Hi Ken,
Thanks again for your reply. I followed that procedure but
Code:
netstat -l | grep http
did not return anything.
Code:
ls /var/log/httpd/error_log
returned
Quote:
|
ls: cannot access /var/log/httpd/error_log: No such file or directory
|
I found /var/log/cups/error_log but it was empty.
Thanks,
Peter.
|
|
|
|
10-29-2011, 11:38 PM
|
#6
|
|
Member
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 538
Rep:
|
If " netstat -l | grep http" didn't return anything on the server, apache probably isn't running. I'm guessing it looked for httpd.conf and gave up. Though that doesn't explain how it worked with localhost.
Maybe Ubuntu puts the httpd log in /var/log. Look through /var/log for a log, maybe this:
Code:
sudo find /var/log -name '*http*'
Or maybe this (press capital G to zip to the end, q to quit)
Code:
sudo less /var/log/messages
I'm not sure what the command is on Ubuntu, but you can try to manually start apache to see what error messags you get. Probably this:
Code:
sudo /etc/init.d/httpd start
Fedora had a default httpd.conf file that I just had to modify, but on Ubuntu if it's empty there is probably an example file you could copy, edit and use. You could look for it with find:
Code:
find /usr/share -name '*httpd.conf*'
find /etc -name '*httpd.conf*'
|
|
|
|
10-30-2011, 03:40 PM
|
#7
|
|
Member
Registered: Oct 2011
Posts: 160
Original Poster
Rep:
|
Quote:
Originally Posted by KenJackson
If " netstat -l | grep http" didn't return anything on the server, apache probably isn't running. I'm guessing it looked for httpd.conf and gave up. Though that doesn't explain how it worked with localhost.
Maybe Ubuntu puts the httpd log in /var/log. Look through /var/log for a log, maybe this:
Code:
sudo find /var/log -name '*http*'
Or maybe this (press capital G to zip to the end, q to quit)
Code:
sudo less /var/log/messages
I'm not sure what the command is on Ubuntu, but you can try to manually start apache to see what error messags you get. Probably this:
Code:
sudo /etc/init.d/httpd start
Fedora had a default httpd.conf file that I just had to modify, but on Ubuntu if it's empty there is probably an example file you could copy, edit and use. You could look for it with find:
Code:
find /usr/share -name '*httpd.conf*'
find /etc -name '*httpd.conf*'
|
It looks like it is a format issue because when I went onto the 11.04 PC and typed
in the URL box then
Code:
file:///var/www/index.html
appeared in the URL box and I saw the web page just fine. I noticed that the IP address for the 11.04 PC was 192.168.1.7 so I tried typing
Code:
192.168.1.7/var/www/index.html
in the URL box. This resulted in the message
Quote:
Not Found
The requested URL /var/www/index.html was not found on this server
|
Thanks,
Peter.
|
|
|
|
10-30-2011, 04:57 PM
|
#8
|
|
Member
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 538
Rep:
|
The " file://..." URL is showing you the file on the local machine. You don't need apache to see that. The browser reads it directly from disk.
But when you specify the IP address, the browser sends an HTTP request to fetch it. If DocumentRoot is configured as /var/www, then the URL should be: http://192.168.1.7/index.html or just: http://192.168.1.7/
Did you try to start or restart apache? I suspect it's not running.
|
|
|
|
10-30-2011, 05:11 PM
|
#9
|
|
Member
Registered: Oct 2011
Posts: 160
Original Poster
Rep:
|
I think I figured it out, mate. I just had to leave out the var/www/ part. So
Code:
192.168.1.7/index.php
and I'm off to the races. I noticed that it's case sensitive as well so
Code:
192.168.1.7/Index.php
doesn't work.
Thanks for your help,
Peter.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:08 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|