Cant Run http://localhost instead of http://localhost:8012 - apache

I try configure my localhost XAMPP on like these step How to change XAMPP apache server port?
But when i try restarted my apache and try open http://localhost instead of http://localhost:8012. It said HTTP Error 404. The requested resource is not found.
My suggestion problem :
on file http-ssl.conf i cant found line ServerName localhost:443
Maybe that my problem cant instead http://localhost instead of http://localhost:8012?? Or did i missing something, if i try open http://localhost:8012 is working.
My XAMMP version is 3.2.2 and my apache is Apache2.4, windows 7. And idk i'm using IIS or not because is not my own computer but is my computer office.

Just in case, the full answer does not answer the question. Only some parts do.
If I understand your question, you want to run your website on http://localhost. I just want to clarify that the normal localhost runs on port 80 i.e. http://localhost:80.
So, port 80 and just the localhost aren't different, so please don't get confused. You should not worry about httpd-ssl.conf, you shouldn't have to change it. The configuration is in the main conf: httpd.conf. And, I don't think the link you've given in your question is similar.
Can you access localhost using https://localhost
After all, I think, you want to change your port from 8012 to 80 (http default).
Please follow the following steps to change the port.
1) Click on Config after opening XAMPP
2) Click on Service And Port Settings
3) Change the port to 80 from your current port
If it still has the same error, do this:
Take a backup of httpd.conf before doing the following.
1) Edit your httpd.conf, change the following.
Listen 8012
To:
Listen 80
If still not working, go ahead and add the following at the end:
<VirtualHost *:80>
ServerAdmin your#email.com
DocumentRoot "C:\path\to\website"
</VirtualHost>
Thanks.
Edit:
The only way you could do this is by running your XAMPP server on a different IP like 127.0.0.2
So, try the following:
Edit httpd.conf and say:
<VirtualHost 127.0.0.2:80>
ServerAdmin your#email.com
DocumentRoot "path to htdocs"
</VirtualHost>
Go to the C:\Windows\System32\drivers\etc
Edit hosts file:
For some time, please add something like this.
127.0.0.2 localhostt
Also
You could also change the port of the application that is running on port 80
Open up the CMD
Run the following command:
netstat -aon | findstr "80"<br>
And get the info of something like:
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 11560<br>
Get the info of the last number i.e is in this post is 11560
Run the following after that
tasklist | findstr "11560"<br>
Replace 11560 to the number that you got running the previous command
And you will know what app is running in the port
My Last Guess:
The new way I found out is by doing this:
Change the listen directive to:
Listen 127.0.0.2:80
Go to the C:\Windows\System32\drivers\etc
Edit hosts file:
Try this:
127.0.0.2 localhost
OR
For some time, please add something like this.
127.0.0.2 localhostt
Hope it works.

Related

What is wrong with my apache Virtual host setup?

I have set up the virtual host like its displayed in the apache documentation:
NameVirtualHost Localhost:8080
<VirtualHost Localhost:8080>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot D:\Users\daniel_diezel\Apache24\htdocs
</VirtualHost>
<VirtualHost Localhost:8080>
ServerName www.otherdomain.tld
DocumentRoot D:\Users\daniel_diezel\Apache24\htdocs
</VirtualHost>
After i saved it and started the httpd.exe the following error accured while starting Apache:
`
(OS 10013)Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulõssig. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs`
But if i change the Port to 8080 its working.
But the problem no is when the apache starts i cant find the server when i type https://domain.ltd in my browser but if I go for Localhost:8080 it shows me the index file on the site.
What can i do to fix it?
There seems to be two different issues. According to your file structure I assume you are using Windows.
Port usage
Port 80 might be already in use. Open CMD and type netstat -ano and find all processes using port 80 apart from the system process (typically PID 4). Identify the processes by using the command tasklist and look for the PIDs using port 80 from the step before.
Now open your task manager and stop all processes if they are not relevant to keep your system running. Now the port binding error should be gone.
Accessing local domain names
domain.tld is resolved by your configured DNS-provider, so it is looked up to be found in the internet. If you want to resolve domain-names locally (before reaching out for the DNS) you have to add it to your host file.
Open C:/Windows/drivers/etc/hosts with a editor of your choice an add the following line:
127.0.0.1 domain.tld
Now everything should work as expected. If you want to use different ports you can also use 127.0.0.1:port domain.tld

MAMP Virtual Hosts not working properly, loading 'It Works!' page

I had an issue last night where MAMP just refused to connect to the Apache server(unsure whether this has something to do with my issue). I decided to uninstall and reinstall. I was able to connect once again, however, when I added my virtual host to the httpd-vhosts.conf file in my MAMP folder, and navigate to it I get brought to a 'It works!' page. (I also realised I get this page by typing localhost even without running MAMP?)
Below are some of my files
httpd.conf(in MAMP)
//Uncommented line below
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
httpd.conf(in MAMP)
NameVirtualHost *:80
<VirtualHost *:80>
ServerName portfolio
DocumentRoot '/Applications/MAMP/htdocs/portfolio'
</VirtualHost>
<VirtualHost *:80>
DocumentRoot '/Applications/MAMP/htdocs'
ServerName localhost
</VirtualHost>
/private/etc/hosts
##
# Host Database
# localhost is used to configure the lookback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 portfolio
This is a copy paste of what I had before which worked 100%, unsure what happened between MAMP stopping working, the uninstall and reinstall. Is there an issue with apache somehow overwriting something? Really out of my depth here with this issue. Is there somewhere else I should be looking to debug this?
For reference, localhost:8888 & localhost:8888/portfolio work as expected, localhost/ & portfolio/ don't, brings me to the 'It works!' page. Before this issue I was able to do 'localhost/phpmyadmin' to bring me to phpmyadmin and 'localhost/portfolio' to bring me to that directory, but neither of those work either. I've been wracking me brain for hours over this, watching tutorials and reading other answers but to no avail.
Anyone have any idea why this is occuring? Any help would be greatly appreciated.
So I eventually figured it out if anyone else has the same issue. I had forgotten previously that I had my localhost running on port 80. However when I tried that before my apache server wouldn't start on MAMP, the reason being was due to port 80 being used by /private/etc/apache2, so I used the answer to this question
https://superuser.com/questions/986775/how-can-i-remove-apache2-that-i-have-installed-in-mac-os-x
to remove apache. (Alternatively I guess you could just change the port number it listens to in the httpd.conf files?) I then changed my MAMP to listen to port 80 and this fixed my problem. Hope this helps anyone else with same issue

Apache server in port number 80

Though the question asked seems to be very ridiculous but I am practically facing this and left with no option but to ask it.
In httpd.conf file whenever I give port no other than 80 it works fine but if I give port no 80 after some time or may be from beginning it stops working means I am not able to get the desired web page though
when I try netstat -ano it shows that apache server is running on port no 80.
previously IIS7 was working on port no 80.I stoped the process.
Locate your apache config and search for:
Listen 80
change 80 to your desired port
Next you may want to change the vHost setting. Find whereever your vhost settings are located (mostly conf/extra/httpd-vhosts.conf) and locate something like this:
<VirtualHost *:80>
ServerAdmin mail#domain.tld
DocumentRoot "path/to/my/document/root"
ServerName subdomain.domain.tld
ErrorLog "path/to/my/error/log/domain.error.log"
CustomLog "path/to/my/access/log/domain.access.log" common
</VirtualHost>
change the 80 here again to your desired port. Restart your apache.
If youre working on unix:
service apache22 start
service apache22 stop
(commands for apache 2.2)
on windows:
net stop apache2.2
net start apache2.2
(commands for apache 2.2)
Greetings
(make sure your firewall doesnt block your desired port and its not used by another programm. For additional help you should always check your error logs.

XAMPP apache server not using the ports I desire, not certain why

So, I've been setting up this HTTP server for a school project that has to be able to maintain multiple domains through virtual hosts. Using XAMPP I have my server set up, I thought I'd done it properly but perhaps not.
I had heaps of issues with not being able to listen to a port, to solve this I used (in httpd.conf under apache/conf/)
Listen 0.0.0.0:8080
ServerName localhost:8080
If I used 80/81/8080/321/any combination that did not have the prefix 0.0.0.0 it told me the port could not be listened or whatever (sorry, a little rusty with my syntax).
I set up my first virtual host up like so (under apache/conf/extra/httpd-vhosts.conf):
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "H:/xampp2/xampp/htdocs"
ServerName localhost:8080
<Directory "H:/xampp2/xampp/htdocs">
Option Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I thought this seemed all good and well and I don't believe I've modified anything else. To me, I would expect that this means my Apache server would use port 8080 for the server? However, when I start Apache in XAMPP it states quite clearly
Apache started [Port 80]
Why would this be port 80?
In conjunction, localhost:8080 doesn't navigate me to the documents, but localhost:80 or localhost do. I presume that this just means it's still on port 80. I've tried resetting my computer and XAMPP.
If you need any more information, please let me know. I tried following guides such as this one: http://ailoo.net/2008/07/set-up-multiple-virtual-hosts-on-xampp-for-windows/
Cheers.
Oh, I also edited my Windows HOSTS file; it looks like so:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 localhost:8080
Edit: New error... Now getting this when I init, doesn't seem to be affecting it though:
ERROR: Status Check Failure [3]
This program must be run from your XAMPP root directory.
It is being run from teh root directory as far as I can tell.
Ok Im not advanced in this area either. However after much playing around with XAMPP and following a few different guides I got mine working.
The Host under drivers seems abit weird. I declared mine as:
127.0.0.1:8080 test.localhost.com
127.0.0.1:8080 test2.localhost.com
Back up you Xampp, then extract a clean install to C: - Just because that Status check failure sounds like bad news.
!Remember to run setup_xampp.bat from the xampp directory and install the apache service!
Then under you httpd.conf add:
ServerRoot C:\xampp\apache
Listen 7070
Listen 8080
Listen 9090
Apache might not like that at first but meh.
The ServerRoot may already be declared above the Listen spot so just double check.
After that head to C:\xampp\apache\conf\extra.
Edit the httpd-vhosts.conf.
Under the section Name-based virtual hosting add:
NameVirtualHost *:7070
NameVirtualHost *:8080
NameVirtualHost *:9090
There will be a couple of examples of virtual hosts below that. Add:
<VirtualHost *:7070>
DocumentRoot "C:/xampp/www/YOURWEBSITEDIR1"
ServerName test.localhost.com
<Directory "C://xampp/www/YOURWEBSITEDIR1">
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:9090>
DocumentRoot "C:/xampp/www/YOURWEBSITEDIR2"
ServerName test2.localhost.com
<Directory "C://xampp/www/YOURWEBSITEDIR2">
Allow from all
</Directory>
</VirtualHost>
Not the double slash in the Directory tag. Now ensure there is an index.html under each of those directories. Restart the apache (Stop, start).
I cant navigate to the test.localhost.com URLs, probably due to the fact they are terribly wrong in the HOSTs config. Though I can connect to 127.0.0.1:7070, 127.0.0.1:9090 and access the webpages from there.
Also 127.0.0.1:8080 connects me to the xampp welcome panel that localhost used to connect you too.
Hope this helps and good luck!
I'm pretty sure that saying 'listening on port 80' is hard-coded into XAMPP, regardless of the port you use. Thus, your code should work fine.
In my .conf file, it just says "listen 80" instead of Listen 0.0.0.0:8080
Cheers.

XAMPP (WIN7) port change and vhosts

I've decided to change the ports for Apache to clear up some conflicts with other applications, and maybe even give IIS a shot in the future. I've run into the problem described below.
The basic context:
WIN 7 x64
XAMPP 1.7.4 (Apache 2.2.17, MySQL 5.5.8, PHP 5.3.5)
So I've changed the default Apache port from 80 to 8080, by changing this in the httpd.conf:
Listen 8080 (was Listen 80)
ServerName localhost:8080 (was ServerName localhost)
In my vhosts file I have:
NameVirtualHost 127.0.0.1:8080
And several virtual hosts defined like this:
<VirtualHost 127.0.0.1:8080>
DocumentRoot "somepath"
ServerName servername
<directory "somepath">
usual stuff here
</directory>
</VirtualHost>
When I try to access the virtual host using the servername defined above it does not work without explicitly specifying the port:
servername:8080
It would also seem that the port defined in the vhosts file does not make any difference, whatever I tried (80, 8080, nothing), it allways requires the port to be given with the server name.
phpinfo() says:
SERVER_PORT: 8080
Apache error logs do not show any errors.
I guess I'm wondering if this is normal behaviour, or there is something I overlooked.
The 80 port is default for browsers so that's why you don't need to access servername:80. In your case it's normal to acces server like this : servername:8080
If your want to access localhost without specify the port number in the URL http://localhost instead of http://localhost:8080.
Open Xampp Control Panel
Go to Config ► Service and Port Settings ► Apache
Replace the Main Port value ​​with 8080.
Save Service settings
Save Configuration of Control Panel
Restart the Apache Server