The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Odd error with Apache- NO localhost.
newwebdesigner
post Aug 18 2014, 03:09 PM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



I am having a odd error with Apache 2.4. I installed it, everything should be good, I start it, and I get a 404 error on localhost.I am new to all this, I am using the port 8080 but if I try localhost:8080 is still doesn't work. I don't have a clue as to what is wrong.

This post has been edited by newwebdesigner: Aug 18 2014, 03:12 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 18 2014, 03:12 PM
Post #2


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



nvm- I reinstalled everything and it is fine,so ignore this!

This post has been edited by newwebdesigner: Aug 18 2014, 03:12 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 18 2014, 03:43 PM
Post #3


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



Okay, now I have another problem. So now I am trying to make it instead of localhost, mywebsite.localhost:8080, but it is not working. When I go into Cmd and try to view the errors in the C:\Apache24\bin and do httpd.exe, a windows popup appears and says Apache 24 has stoped working. Any ideas?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 19 2014, 03:54 AM
Post #4


.
********

Group: WDG Moderators
Posts: 7,701
Joined: 10-August 06
Member No.: 7



QUOTE(newwebdesigner @ Aug 18 2014, 10:43 PM) *

now I am trying to make it instead of localhost, mywebsite.localhost:8080,

I don't know if/how you can use the format "mywebsite.localhost", instead I use http://mywebsite1/ http://mywebsite2/ etc for my local web sites.

QUOTE
but it is not working.

How did you configure Apache to map the above URL to the directory of your web site files?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Aug 19 2014, 05:04 AM
Post #5


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,747
Joined: 9-August 06
Member No.: 6



Yea, you can do that. You set it up with <VirtualHost> in httpd.conf. I'd have to read the details up in the documentation, but as I recall it's pretty straightforward.

newwebdesigner, what have you done to make the sub work? Show us.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
newwebdesigner
post Aug 19 2014, 10:25 AM
Post #6


Newbie
*

Group: Members
Posts: 12
Joined: 15-August 14
Member No.: 21,405



Christian, I was watching a helpful video that made it work with mywebsite.localhost.Pandy- I tried that all with vituralhost,i don't understand why it is not working.
If you want to see the code, here is a snipit because I know if I copied the whole httpd.conf and httpd-vhosts.conf it would be very long post.
<VirtualHost *:8080>
ServerAdmin webmaster@mywebsite.localdomain:8080
DocumentRoot "c:/Users/MyUser/mywebsite"
ServerName mywebsite.localdomain:8080
ErrorLog "logs/mywebsite.localdomain:8080-error.log"
CustomLog "logs/mywebsite.localdomain:8080-access.log" common
</VirtualHost>

And then here is the line in the httpd.conf that I had to edit:

Include conf/extra/httpd-vhosts.conf
Also, oddly enough, even when I stop apache localhost:8080 is still up, with "it works!"

This post has been edited by newwebdesigner: Aug 19 2014, 10:29 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Aug 19 2014, 11:29 AM
Post #7


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,747
Joined: 9-August 06
Member No.: 6



IIRC correctly you must have an entry for each domain/subdomain.

Something like so.

CODE
<VirtualHost localhost>
DocumentRoot "c:/Users/MyUser/mywebsite"
ServerName localhost
</VirtualHost>

<VirtualHost mywebsite.localhost>
DocumentRoot "c:/dev/blog"
ServerName mywebsite.localhost
</VirtualHost>


I didn't quite follow everything in your example, so I stuck to localhost. See if that works and if it does you can use it as a starting point.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 19 2014, 12:01 PM
Post #8


.
********

Group: WDG Moderators
Posts: 7,701
Joined: 10-August 06
Member No.: 7



QUOTE(newwebdesigner @ Aug 19 2014, 05:25 PM) *

here is a snipit because I know if I copied the whole httpd.conf and httpd-vhosts.conf it would be very long post.
<VirtualHost *:8080>
ServerAdmin webmaster@mywebsite.localdomain:8080
DocumentRoot "c:/Users/MyUser/mywebsite"
ServerName mywebsite.localdomain:8080
ErrorLog "logs/mywebsite.localdomain:8080-error.log"
CustomLog "logs/mywebsite.localdomain:8080-access.log" common
</VirtualHost>

Is the above from httpd.conf? I don't put my VirtualHost directives in there (on Apache 2.2), instead I put them in the httpd-vhosts.conf file:

CODE
<VirtualHost 127.0.0.1>
ServerName foo
ServerAdmin christianj@foo.com
DocumentRoot "C:/Users/christianj/Documents/foo/htdocs"
ScriptAlias /cgi-bin/ "C:/Users/christianj/Documents/foo/cgi-bin"
</VirtualHost>

(details may vary), combined with entries in Windows' hosts file at C:\Windows\System32\drivers\etc\hosts like these:

CODE
127.0.0.1      foo
127.0.0.1      bar

I haven't tried this for years, so don't rely too much on my "advice". No idea if it will work with the "foo.localhost" format.

QUOTE
Also, oddly enough, even when I stop apache localhost:8080 is still up, with "it works!"

Probably just a cached page in the browser.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Aug 19 2014, 03:35 PM
Post #9


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,747
Joined: 9-August 06
Member No.: 6



So I guess that has changed. Haven't used the latest Apache on my own machine.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 19 2014, 04:33 PM
Post #10


.
********

Group: WDG Moderators
Posts: 7,701
Joined: 10-August 06
Member No.: 7



No my Apache 2.2 is from 2007 or so.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Aug 19 2014, 04:47 PM
Post #11


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,747
Joined: 9-August 06
Member No.: 6



Hm, I'm pretty sure I did it in httpd.conf. Didn't touch very much else. Maybe it works in either file?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 19 2014, 06:06 PM
Post #12


.
********

Group: WDG Moderators
Posts: 7,701
Joined: 10-August 06
Member No.: 7



According to http://httpd.apache.org/docs/2.2/vhosts/name-based.html it seems you can use multiple VirtualHost directives in it.

For some reason I can't find anything about httpd-vhosts.conf in the Apache documentation, while lots of other sites mention it. unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
imort
post Jun 18 2016, 08:06 AM
Post #13





Group: Members
Posts: 7
Joined: 18-June 16
Member No.: 24,338



QUOTE(newwebdesigner @ Aug 19 2014, 09:25 PM) *

Also, oddly enough, even when I stop apache localhost:8080 is still up, with "it works!"


I think that you need to add the 'mywebsite.localdomain' domain to your Windows\System32\Drivers\Etc\hosts file too.
Your local PC just didn't aware about that domain I suppose.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th October 2017 - 10:24 PM