Localhost выдает ошибку 404

I am using XAMPP. and internal server of Django.
When I browse to localhost or 127.0.0.1, It shows
Not Found . HTTP Error 404. The requested resource is not found.

It sometimes works fine and other times pops up the error.

Moreover, when I browse to my project url, ie 127.0.0.1:8000/cc , the project url works fine.

Any ideas why is this happening?

asked Jul 23, 2013 at 7:21

Praful Bagai's user avatar

Praful BagaiPraful Bagai

16.7k50 gold badges136 silver badges267 bronze badges

You need to add the port number to every address you type in your browser when you have changed the default port from port 80.

For example: localhost:8000/cc .

A little edition here is that it should be 8080 in place of 8000.
For example —
http://localhost:8080/phpmyadmin/

suranjan dutta's user avatar

answered Jul 23, 2013 at 16:59

George Chondrompilas's user avatar

1

I had the same problem and here is how it worked for me :

1) Open XAMPP control panel.

2)On the right top corner go to config > Service and Port setting
and change the port (I did 81 from 80).

3)Open config in Apache just right(next) to Apache admin Option and click on that and select first one (httpd.conf) it will open in the notepad.

4) There you find port listen 80 and replace it with 81 in all place and save the file.

5) Now restart Apache and MYSql

6) Now type following in Browser :
http://localhost:81/phpmyadmin/

I hope this works.

answered Dec 11, 2019 at 10:57

Badri Paudel's user avatar

Many frameworks like Laravel , Django ,… run local web server that work on another port except 80.For example port 8000 is the most commen port that these local web servers use.

So when you run web servers that frameworks build them and type localhost:8000 it works well.But web server that xampp(apache) runs it has another port.In default it has 80 that it does not need to type it in url.And if you change port you should mention it in url.

**In brief:**web server in framework is different from web server in xampp . Check the port of each server and mention it in url when you use them.

answered Feb 14, 2020 at 17:21

akbar's user avatar

akbarakbar

6256 silver badges12 bronze badges

If your server is still listening on port 80, check the permission on the DocumentRoot folder and if DirectoryIndex file existed.

answered Dec 26, 2014 at 8:42

Klaus's user avatar

KlausKlaus

4515 silver badges8 bronze badges

Try checking your web routes most likely there is nothing pointing to the default path in your routes //default path or route Route::get('/', [ PagesController::class,'index']); in this case

answered Mar 2, 2021 at 11:58

developers ukwelys's user avatar

If you are getting a 404 Error in PHP or you are not able to see PHPMyAdmin,
it might be you have changed your default port.
For instance, I have changed from port 80 to 8081. So after changing the port, you have to just type http://localhost:8081 in your browser.

eg: localhost:yourPortName/
phpmyadmin Page — http://localhost:8081/phpmyadmin/

sayil aguirre's user avatar

answered Mar 14, 2022 at 5:15

Praveen Prajapati's user avatar

  1. Open XAMPP control panel.

2)On the right top corner go to config > Service and Port setting and change the port. Under the Apache tab , change main port to 8080 and SSL port to 4433 and click save.

screenshot of Service and Port

3) Change the Default Port Settings of the httpd.conf File

  • Open config in Apache just right(next) to Apache admin Option and
    click on that and select the first one (httpd.conf) it will open in
    the notepad.
  • Locate 80( to get started, press Ctrl + F, then enter “80” in the
    search field.)
  • Modify the following lines :
    Port 80 to Port 8080
    Listen 80 to Listen 8080
    servername localhost:80 to servername localhost:8080

4) Update the Default Port Settings in the http-ssl.conf File

  • Open config in Apache just right(next) to Apache admin Option and
    click on that and select the first one (http-ssl.conf) it will open
    in the notepad.

  • Locate 443( to get started, press Ctrl + F, then enter “443” in
    the search field.)

  • Modify the following sentences:

         Listen 443   => Listen 4433
         <VirtualHost _default_:443>   =>  <VirtualHost _default_:4433>
         ServerName www.example.com:443   => ServerName www.example.com:4433 
    
  1. Now restart Apache and MYSql

  2. Now type following in Browser : http://localhost:8080/phpmyadmin/
    Note: you can use any other port

answered Jan 5 at 19:44

Meenu Mathew's user avatar

open D:\xampp\apache\conf\extra\httpd-vhosts.conf

ServerName localhost
DocumentRoot «D:\xampp\htdocs»
SetEnv APPLICATION_ENV «development»

DirectoryIndex index.php
AllowOverride FileInfo
Require all granted

Restart Apache server

and then refresh your given url

answered Jul 16, 2016 at 12:31

Pankaj's user avatar

PankajPankaj

1692 silver badges11 bronze badges

In my case, it was just a VPN problem.

I was working in my companies network (via VPN).
After switching to private network, the problem disappeared!

answered Oct 19, 2021 at 8:49

Max Mark's user avatar

Max MarkMax Mark

712 silver badges9 bronze badges

I am using XAMPP. and internal server of Django.
When I browse to localhost or 127.0.0.1, It shows
Not Found . HTTP Error 404. The requested resource is not found.

It sometimes works fine and other times pops up the error.

Moreover, when I browse to my project url, ie 127.0.0.1:8000/cc , the project url works fine.

Any ideas why is this happening?

asked Jul 23, 2013 at 7:21

Praful Bagai's user avatar

Praful BagaiPraful Bagai

16.7k50 gold badges136 silver badges267 bronze badges

You need to add the port number to every address you type in your browser when you have changed the default port from port 80.

For example: localhost:8000/cc .

A little edition here is that it should be 8080 in place of 8000.
For example —
http://localhost:8080/phpmyadmin/

suranjan dutta's user avatar

answered Jul 23, 2013 at 16:59

George Chondrompilas's user avatar

1

I had the same problem and here is how it worked for me :

1) Open XAMPP control panel.

2)On the right top corner go to config > Service and Port setting
and change the port (I did 81 from 80).

3)Open config in Apache just right(next) to Apache admin Option and click on that and select first one (httpd.conf) it will open in the notepad.

4) There you find port listen 80 and replace it with 81 in all place and save the file.

5) Now restart Apache and MYSql

6) Now type following in Browser :
http://localhost:81/phpmyadmin/

I hope this works.

answered Dec 11, 2019 at 10:57

Badri Paudel's user avatar

Many frameworks like Laravel , Django ,… run local web server that work on another port except 80.For example port 8000 is the most commen port that these local web servers use.

So when you run web servers that frameworks build them and type localhost:8000 it works well.But web server that xampp(apache) runs it has another port.In default it has 80 that it does not need to type it in url.And if you change port you should mention it in url.

**In brief:**web server in framework is different from web server in xampp . Check the port of each server and mention it in url when you use them.

answered Feb 14, 2020 at 17:21

akbar's user avatar

akbarakbar

6256 silver badges12 bronze badges

If your server is still listening on port 80, check the permission on the DocumentRoot folder and if DirectoryIndex file existed.

answered Dec 26, 2014 at 8:42

Klaus's user avatar

KlausKlaus

4515 silver badges8 bronze badges

Try checking your web routes most likely there is nothing pointing to the default path in your routes //default path or route Route::get('/', [ PagesController::class,'index']); in this case

answered Mar 2, 2021 at 11:58

developers ukwelys's user avatar

If you are getting a 404 Error in PHP or you are not able to see PHPMyAdmin,
it might be you have changed your default port.
For instance, I have changed from port 80 to 8081. So after changing the port, you have to just type http://localhost:8081 in your browser.

eg: localhost:yourPortName/
phpmyadmin Page — http://localhost:8081/phpmyadmin/

sayil aguirre's user avatar

answered Mar 14, 2022 at 5:15

Praveen Prajapati's user avatar

  1. Open XAMPP control panel.

2)On the right top corner go to config > Service and Port setting and change the port. Under the Apache tab , change main port to 8080 and SSL port to 4433 and click save.

screenshot of Service and Port

3) Change the Default Port Settings of the httpd.conf File

  • Open config in Apache just right(next) to Apache admin Option and
    click on that and select the first one (httpd.conf) it will open in
    the notepad.
  • Locate 80( to get started, press Ctrl + F, then enter “80” in the
    search field.)
  • Modify the following lines :
    Port 80 to Port 8080
    Listen 80 to Listen 8080
    servername localhost:80 to servername localhost:8080

4) Update the Default Port Settings in the http-ssl.conf File

  • Open config in Apache just right(next) to Apache admin Option and
    click on that and select the first one (http-ssl.conf) it will open
    in the notepad.

  • Locate 443( to get started, press Ctrl + F, then enter “443” in
    the search field.)

  • Modify the following sentences:

         Listen 443   => Listen 4433
         <VirtualHost _default_:443>   =>  <VirtualHost _default_:4433>
         ServerName www.example.com:443   => ServerName www.example.com:4433 
    
  1. Now restart Apache and MYSql

  2. Now type following in Browser : http://localhost:8080/phpmyadmin/
    Note: you can use any other port

answered Jan 5 at 19:44

Meenu Mathew's user avatar

open D:\xampp\apache\conf\extra\httpd-vhosts.conf

ServerName localhost
DocumentRoot «D:\xampp\htdocs»
SetEnv APPLICATION_ENV «development»

DirectoryIndex index.php
AllowOverride FileInfo
Require all granted

Restart Apache server

and then refresh your given url

answered Jul 16, 2016 at 12:31

Pankaj's user avatar

PankajPankaj

1692 silver badges11 bronze badges

In my case, it was just a VPN problem.

I was working in my companies network (via VPN).
After switching to private network, the problem disappeared!

answered Oct 19, 2021 at 8:49

Max Mark's user avatar

Max MarkMax Mark

712 silver badges9 bronze badges

  1. How do I fix localhost 404 error?
  2. How do I fix localhost error?
  3. How do I resolve HTTP Error 404 in localhost WAMP server for PHP and Mysql?
  4. How do I fix PHP 404 in xampp?
  5. How do I fix Error 404 on Windows 10?
  6. How do I fix error 404 in PHP?
  7. Why the localhost is not working?
  8. Why does localhost refuse to connect?
  9. What happened when I type http localhost 8080 in browser?
  10. How do you solve HTTP Error 404 the requested resource is not found in xampp?
  11. Why phpmyadmin is not working in xampp?

How do I fix localhost 404 error?

You need to add the port number to every address you type in your browser when you have changed the default port from port 80. For example: localhost:8000/cc . Type in «netstat -ano» into your command line. I saw that it was showing something for Local Address port 0.0.

How do I fix localhost error?

What’s the problem? — Stack Overflow.

If you’re still having this problem, try this:

  1. Edit your hosts file (with elevated privileges)
  2. Uncomment the line «#127.0. 0.1 localhost» (ie- remove the #)
  3. Save the file as is. hosts with no extension.

How do I resolve HTTP Error 404 in localhost WAMP server for PHP and Mysql?

1-Change port number again like Listen 8081 and restart all services, then click LocalHost.

So you should do them;

  1. Click on Wampserver the go to Apache -> httpd.conf.
  2. Find Listen 80 and change it to Listen 8080.
  3. save .txt filen and restart Wampserver.

How do I fix PHP 404 in xampp?

Re: 404 Error (xampp)

If you entered the URL manually please check your spelling and try again. If you think this is a server error, please contact the webmaster.

How do I fix Error 404 on Windows 10?

How do I fix error 404 on Windows 10? You can fix the error by simply checking your URL. In most cases, the 404 issues are caused by a mistype of the URL.

  1. Check your URL. …
  2. Clear your cache. …
  3. Try entering the desired URL into Google’s search. …
  4. Use Google Cache. …
  5. Disable the proxy. …
  6. Change the hosts file.

How do I fix error 404 in PHP?

How to Avoid 404s and Redirect Old URLs in PHP

  1. Create a 404 error-handling file. If you’re yet to have a “not found” page, create a basic one named 404.php in the root of your website: <? …
  2. Configure your server. You now need to tell your server that all 404 errors should be handled by the 404.php file. …
  3. Create the redirection system.

Why the localhost is not working?

When you use «localhost», it can get matched by a ServerAlias or ServerName configuration. If that configuration is bad, (eg: wrong wwwroot), then it won’t work with the localhost, but might with an IP. So check your httpd. conf for localhost .

Why does localhost refuse to connect?

Localhost refusing a connection means that your browser (my assumption) is receiving a response from the server. … In the case of a refusal it means that the server is receiving the connection and actively refusing it, which narrows down the problem considerably.

What happened when I type http localhost 8080 in browser?

Any hostname or IP address followed by a : and a port number like :8080 tells the browser to connect to that TCP port instead of the default web-server port 80.

How do you solve HTTP Error 404 the requested resource is not found in xampp?

How to Fix the HTTP Error 404 “The Requested Resource Is Not Found” in XAMPP (5 Tips)

  1. Be Sure You Typed the URL Correctly. Before you attempt any other fixes, we recommend double-checking that you haven’t mistyped or included anything unnecessary in the URL. …
  2. Check Your . htaccess File. …
  3. Deactivate and Uninstall New Plugins.

Why phpmyadmin is not working in xampp?

xampp Not Found The requested URL /phpmyadmin/ was not found on this server. I solved this problem by changing the proxy of my firefox browser, go to menu tools-Option find tab Network, click button settings. … Try now typing localhost/xampp then it should show Welcome to XAMPP for Windows!

The 404 or Not Found error message indicates that the client was able to communicate with a given server, but the server could not find what was requested.

The web site hosting server will typically generate a «404 Not Found» web page when a user attempts to follow a broken or dead link, such as when the requested file (page) is not at that URL, which will most likely mean that your phpmyadmin is not located at or symlinked to http://localhost/phpmyadmin.

I have previously come across this situation personally and my solution was actually very simple;

Copy/move phpmyadmin into /var/www or wherever you store your web files:

cp -R '/usr/share/phpmyadmin' '/var/www/'

Then create a new VirtualHost in your apache.conf file, or as I do have a .conf for each VirtualHost.
Bare in mind you will have to make sure there are no conflicting VirtualHost’s, a simple straight forward VirtualHost phpmyadmin.conf file;

<VirtualHost *:80>

ServerName phpmyadmin.local
ServerAdmin admin@your-email.com
DocumentRoot /var/www/phpmyadmin

    <Directory var/www/phpmyadmin>
        AllowOverride All
        Order allow,deny
        Allow from  all
        Require all granted
    </Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Don’t forget to do;

sudo service apache2 restart

You can then go one step further in your organization regarding your setup, you may notice that my ServerName is phpmyadmin.local, this the most simple thing to do and its known as local subdomains.
To implement this you will need to do the following (of course choose your favorite text editor);

sudo gedit /etc/hosts

And here is my hosts file, full to the brim of local subdomains;

127.0.0.1   localhost
127.0.1.1   jack-mint
127.0.0.1   filmod.tk.local
127.0.0.1   filmod.uk.to.local
127.0.0.1   facebook-phishing.local
127.0.0.1   phishing
127.0.0.1   new.uksss.home
127.0.0.1   theystolemybaby.uk.local
127.0.0.1   theystolemybaby.uk.to
127.0.0.1   theystolemybaby.uk
127.0.0.1   theystolemybaby.uk.undo.it.local
127.0.0.1   theystolemymail.local
127.0.0.1   phpmyadmin.local
127.0.0.1   owa.local
127.0.0.1   itools.uk.to.local
127.0.0.1   facebook-phishing.local
127.0.0.1   lite.ml.local
127.0.0.1   rsync.local
127.0.0.1   babysnatchers.local
127.0.0.1   soon.local
10.0.0.5    sams.eth.local <- this is another machine on my network
10.0.0.6    kali.wlan.local <- as is this
127.0.0.1   hiawatha.monitor.local
127.0.0.1   hiawatha.local
127.0.0.1   w3schools.local
127.0.0.1   banshee.local
127.0.0.1   italk.local
127.0.0.1   wp-filmod.local
127.0.0.1   wordpress.local
127.0.0.1   wordpress4.3.local
127.0.0.1   films.local
127.0.0.1   movie-db
127.0.0.1   example-code.local
127.0.0.1   pythonscraping.local

# temp
#10.42.0.1   italk.local <- this is also another machine on my network
192.168.43.93   wp-filmod.local <- as is this

You can literally use nearly anything you want but I guess its good practice to use ‘subdomain.domain’.
You can use IP addresses from your entire network, essentially what you put in the hosts file an IP address that when typed in your local browser your system will first look at your hosts file and if that URL isnt in there you will be forwarded to an external DNS. Basically this a local DNS service that works like a charm.

And then in my browser I use the URL http://phpmyadmin.local or just phpmyadmin.local

  • Печать

Страницы: [1] 2 3  Все   Вниз

Тема: 404 ошибка [Apache2/localhost]  (Прочитано 6471 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
miha14082

Здравствуйте! У меня проблема: у меня есть программа которая берёт файлы с сайта. И они вместе находятся на одной VDS.

Вот ошибка:
root@tc:~# wget http://localhost/lk/upload/skins/miha14082.png
—2016-08-23 11:11:02—  http://localhost/lk/upload/skins/miha14082.png
Resolving localhost (localhost)… ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80… connected.
HTTP request sent, awaiting response… 404 Not Found
2016-08-23 11:11:02 ERROR 404: Not Found.


Оффлайн
unimix

Ошибка 404 = запрашиваемый ресурс не найден.


Оффлайн
miha14082

Ну вот в этом и проблема. Что на сайте есть файл по этому пути. А если быть точнее — на обоих доменах (домен и поддомен)


Оффлайн
unimix

Возможно, для решения проблемы надо настроить Apache.


Оффлайн
miha14082

Можешь помочь? Ну апач настроен вроде (ISPmanager стоит)


Оффлайн
unimix

То, что веб-сервер выдаёт ошибку 404 не является ошибкой работы сервера. То, что wget сообщает об этом, также не является проблемой. То, что «на обоих доменах (домен и поддомен) есть файл по этому пути» ни о чём не говорит.

Что работает не так и как надо? Почему запрос делается без использования доменного имени (где доступ к файлу есть)?


Оффлайн
miha14082

Если по домену — работает всё. А если через localhost — нет.


Оффлайн
AnrDaemon

Спасибо, мы это поняли.
Расскажите, в чём ПРОБЛЕМА?

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


Оффлайн
miha14082

Моё ПО получает ошибку 404


Оффлайн
AnrDaemon

Что, в принципе, предсказуемо.
Ибо на сайте localhost этих документов нет и быть не должно.

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


Оффлайн
𝓝𝓲𝓻𝓭

Ибо domen.com (условно) и localhost это далеко не одно и то же даже если крутятся на одной машине. Чтоб ресурсы domen.com были доступны по localhost нужно в апаче прописать виртуальный хост по умолчанию ту да же куда прописан domen.com но лучше этого не делать. Что мешает брать файлы по domen.com?

Больше всего глупостей в течение дня совершает человек, который рано встаёт и поздно ложится.


Оффлайн
miha14082

А как сделать чтобы на локалхост отдавал то же что на основной домен?


Оффлайн
AnrDaemon

Ты невнимательно читал, что тебе пишут люди?
НЕ НАДО так делать.

Хотите получить помощь? Потрудитесь представить запрошенную информацию в полном объёме.

Прежде чем [Отправить], нажми [Просмотр] и прочти собственное сообщение. Сам-то понял, что написал?…


Оффлайн
miha14082


Оффлайн
virusoft

А как сделать чтобы на локалхост отдавал то же что на основной домен?

Прописать в апаче домен и локалхост в одно и то же место. Виртуальный хост на то и предназначен, чтобы разграничивать достап к имеющейся информации. Не даром на одном серваке (компьютере) может быть несколько сайтов и они никак не пересекаются. Ибо каждый сайт (хост, домен) лежит в своем месте. Пропиши в апаче путь до локалхоста такой же как к домену.

Если работает — не трогай. Linux — гибкая система, но один раз прогнувшись может обратным ходом распрямиться и ударить по самому (…) месту. Думай о будущем и все будет хорошо.


  • Печать

Страницы: [1] 2 3  Все   Вверх

Понравилась статья? Поделить с друзьями:
  • Libre calc ошибка 510
  • Litecoin кошелек ошибка
  • Localhost 756 атол ошибка
  • Libre calc ошибка 508
  • Listboxer список ошибок