Silk Road forums
Discussion => Off topic => Topic started by: CapnJack on May 31, 2012, 10:48 pm
-
I'm trying to learn website programming and am having trouble with having it run the way I want.
When I test the site on the server, it is browsing to localhost and there are no issues. However, if I go to the site from another computer on the network, localhost still comes up and I can't browse to the pages. How do I change the setting on the Ubuntu server so it points to the correct place and I can view the pages on the other computer?
-
I'm not sure to understand what you are asking. Did you put your website inside apache and configured it properly? Did you set your href as relative links and not absolute? Are you specifying the right ip address within the browser? And if you are trying to access your machine from outside your lan, did you forward the port 80 on your router?
-
I'm trying to learn website programming and am having trouble with having it run the way I want.
When I test the site on the server, it is browsing to localhost and there are no issues. However, if I go to the site from another computer on the network, localhost still comes up and I can't browse to the pages. How do I change the setting on the Ubuntu server so it points to the correct place and I can view the pages on the other computer?
I'm not sure if I got this right but I think you don't know what "localhost" means. "localhost" resolves to the IP address 127.0.0.1 which always points a computer to itself. So if you want to access the web server from another computer, you can't use localhost. Instead you have to use the server's IP address (e.g. 192.168.1.50). If you don't know the server's local IP address, open up a terminal windows and type "ifconfig". This will list the configurations of all network devices. If you're using a wired connection it will be called eth0 and if you're using WiFi it will be called wlan0 or ath0 or something similar.
-
Yes the website is inside apache but I'm not sure if I configured it the right way. If I remember correctly it asked for the server name and I left it as localhost (but I could be mistaken)
If I understand relative vs absolute, the pages I programmed, and are working correctly, are absolute. The ones I downloaded (clipbucket) are the ones that I can't get to work. I'm not sure how they are set up though.
If I put the ip address of the server in the page I am browsing to I can access it. (Example 192.168.x.x/clipbucket) but then none of the links I click on work unless I change localhost in the beginning to the ip address.
Eventually I will be accessing from outside the LAN but I'm not as worried about that part right now.
-
I'm trying to learn website programming and am having trouble with having it run the way I want.
When I test the site on the server, it is browsing to localhost and there are no issues. However, if I go to the site from another computer on the network, localhost still comes up and I can't browse to the pages. How do I change the setting on the Ubuntu server so it points to the correct place and I can view the pages on the other computer?
I'm not sure if I got this right but I think you don't know what "localhost" means. "localhost" resolves to the IP address 127.0.0.1 which always points a computer to itself. So if you want to access the web server from another computer, you can't use localhost. Instead you have to use the server's IP address (e.g. 192.168.1.50). If you don't know the server's local IP address, open up a terminal windows and type "ifconfig". This will list the configurations of all network devices. If you're using a wired connection it will be called eth0 and if you're using WiFi it will be called wlan0 or ath0 or something similar.
I'm aware localhost is referring to the computer itself. Someone told me that you could change what localhost pointed to such as www.sr.com if browsing from another computer. If this is not the case, what do i have to change in order for my page to display correctly without going through each page and changing localhost in the code?
-
I'm trying to learn website programming and am having trouble with having it run the way I want.
When I test the site on the server, it is browsing to localhost and there are no issues. However, if I go to the site from another computer on the network, localhost still comes up and I can't browse to the pages. How do I change the setting on the Ubuntu server so it points to the correct place and I can view the pages on the other computer?
I'm not sure if I got this right but I think you don't know what "localhost" means. "localhost" resolves to the IP address 127.0.0.1 which always points a computer to itself. So if you want to access the web server from another computer, you can't use localhost. Instead you have to use the server's IP address (e.g. 192.168.1.50). If you don't know the server's local IP address, open up a terminal windows and type "ifconfig". This will list the configurations of all network devices. If you're using a wired connection it will be called eth0 and if you're using WiFi it will be called wlan0 or ath0 or something similar.
I'm aware localhost is referring to the computer itself. Someone told me that you could change what localhost pointed to such as www.sr.com if browsing from another computer. If this is not the case, what do i have to change in order for my page to display correctly without going through each page and changing localhost in the code?
Sorry, now I understand your problem. You've made the mistake of using absolute links in your code. You need to use relative ones. Let's say in your index.html there is a link "http://localhost/CapnJack'sPorn/gay.png". If you upload your page to a host, let's say bla.org, you'd have to change every occurrence of "http://localhost" to "http://bla.org". To avoid that you can simply completely omit "http://localhost" and make the links "CapnJack'sPorn/gayfuck.png" or "guestbook.php".
-
Ballzinator is right! Btw you can change what localhost means inside /etc/hosts but it's NOT recommended at all!
-
I'm trying to learn website programming and am having trouble with having it run the way I want.
When I test the site on the server, it is browsing to localhost and there are no issues. However, if I go to the site from another computer on the network, localhost still comes up and I can't browse to the pages. How do I change the setting on the Ubuntu server so it points to the correct place and I can view the pages on the other computer?
I'm not sure if I got this right but I think you don't know what "localhost" means. "localhost" resolves to the IP address 127.0.0.1 which always points a computer to itself. So if you want to access the web server from another computer, you can't use localhost. Instead you have to use the server's IP address (e.g. 192.168.1.50). If you don't know the server's local IP address, open up a terminal windows and type "ifconfig". This will list the configurations of all network devices. If you're using a wired connection it will be called eth0 and if you're using WiFi it will be called wlan0 or ath0 or something similar.
I'm aware localhost is referring to the computer itself. Someone told me that you could change what localhost pointed to such as www.sr.com if browsing from another computer. If this is not the case, what do i have to change in order for my page to display correctly without going through each page and changing localhost in the code?
Sorry, now I understand your problem. You've made the mistake of using absolute links in your code. You need to use relative ones. Let's say in your index.html there is a link "http://localhost/CapnJack'sPorn/gay.png". If you upload your page to a host, let's say bla.org, you'd have to change every occurrence of "http://localhost" to "http://bla.org". To avoid that you can simply completely omit "http://localhost" and make the links "CapnJack'sPorn/gayfuck.png" or "guestbook.php".
Awesome. Thanks for the reply. Is this something I can change through the .htaccess file or do I have to manually fix it in the code.
Also, what would be the problems if I changed the /etc/host file?
-
I'm trying to learn website programming and am having trouble with having it run the way I want.
When I test the site on the server, it is browsing to localhost and there are no issues. However, if I go to the site from another computer on the network, localhost still comes up and I can't browse to the pages. How do I change the setting on the Ubuntu server so it points to the correct place and I can view the pages on the other computer?
I'm not sure if I got this right but I think you don't know what "localhost" means. "localhost" resolves to the IP address 127.0.0.1 which always points a computer to itself. So if you want to access the web server from another computer, you can't use localhost. Instead you have to use the server's IP address (e.g. 192.168.1.50). If you don't know the server's local IP address, open up a terminal windows and type "ifconfig". This will list the configurations of all network devices. If you're using a wired connection it will be called eth0 and if you're using WiFi it will be called wlan0 or ath0 or something similar.
I'm aware localhost is referring to the computer itself. Someone told me that you could change what localhost pointed to such as www.sr.com if browsing from another computer. If this is not the case, what do i have to change in order for my page to display correctly without going through each page and changing localhost in the code?
Sorry, now I understand your problem. You've made the mistake of using absolute links in your code. You need to use relative ones. Let's say in your index.html there is a link "http://localhost/CapnJack'sPorn/gay.png". If you upload your page to a host, let's say bla.org, you'd have to change every occurrence of "http://localhost" to "http://bla.org". To avoid that you can simply completely omit "http://localhost" and make the links "CapnJack'sPorn/gayfuck.png" or "guestbook.php".
Awesome. Thanks for the reply. Is this something I can change through the .htaccess file or do I have to manually fix it in the code.
Also, what would be the problems if I changed the /etc/host file?
Nope, the .htaccess file has nothing to do with that. Simply get a good code editor which can automatically search and replace text. Search for "localhost/" or "http://localhost/" or whatever it is that's superfluous, leave the "replace with" field blank and start the process.
-
I appreciate all the help! Looks like it's gonna be another long night of drinking and learning....