Not able to acess php file in xampp ubuntu through Local host - php

Hello I have installed xampp/lampp on windows and am trying to open website in local host using:
http://localhost/htdocs/my-first-project/index.php
I have also tried
http://localhost/my-first-project/index.php
But it always shows following error:
Not Found The requested URL was not found on this server.
Apache/2.4.41 (Ubuntu) Server at localhost Port 80
But my local host page and phpmyAdmin is running without any problem
I also want to mention that I have set my Apache server port to 8080.
Thank you in advance

Have you already tried to place your index.php in the DocumentRoot Folder and access it from there?

Related

How do I know what server name or web address was set on Nginx

I am trying to setup LEMP (Linux, Nginx, MySQL, PHP) stack on my PC to use with Wordpress.
I follow the instructions on this website. I see that the folder of wordpress in www folder was successfully extracted.
I can also verify that Nginx is running. However, I don't know how to get the wordpress index.php page on the browser.
On windows, I simply go to the browser and type localhost/webprojectfoldername or 127.0.0.1/webprojectfoldername
However, when I try to access the index.php of wordpress via localhost, I get the Apache page.
I would like to use Nginx as server but not Apache. I guess at this point, I don't know what servername or ipaddress to put on the browser to get to Nginx's page or Wordpress's index.php
I don't know how to identify the servername that was setup. On Windows, I simply use localhost or 127.0.0.1.
Any thoughts on how I identify it on Ubuntu?
I'd appreciate any help.
Thank you.
*** EDIT (Added Screenshot of Nginx configuration) ****
Either:
nginx is listening on a different port
By default, HTTP works over port 80, but when you connect to that port you are reaching Apache.
You need to find the port nginx is listening on (from the article you link to: listen 80 default_server; shows 80 but lets say it was 81) and connect to that instead: http://localhost:81/`
nginx and apache are trying to listen on the same port and apache won
You need to turn off Apache (and possibly restart nginx).

Issue in starting Apache from direct url Localhost

I used to work on localhost before and never had such issue, the issue was with Apache that was not starting so I went to my http.conf file and changed the port 80 to 8080 and from then I have to put the url present in the image. I just want to use the "localhost/projectname" which is not running at the moment.

Apache: Your requested host "localhost" could not be resolved by DNS

I am working on my old windows 7 user for a month and everything works fine but eventually, our admin gave me new ADID (active directory ID). Then when i log on using that ADID. My localhost is not working anymore. It gives me an error below :
Error (dns_unresolved_hostname)
Your requested host "localhost" could not be resolved by DNS.
For assistance, Please. contact our Help Desk.
I tried to navigate at http://ip_address/ and it is working fine but the localhost is really gives me a headache.
But when i try to log on using my old ADID. Everything is back to normal. Already tried to reinstall xampp and laragon on my new ADID. Already tried everything i saw on the internet, and still not working.
By the way, this is my hosts
127.0.0.1 localhost
127.0.0.1 sample1.dev
127.0.0.1 sample2.dev
My configuration on my XAMPP is the default. I haven't reconfigure it yet since fresh install.
Update : While i'm investigating this case, i try to remove my internet connection then navigate to http://localhost. My browser says "No internet connection" so in my understanding, my localhost and 127.0.0.1 is pointing outside my local machine. Any idea guys?
This article help me much.
All i did was to remove my proxy temporarily and run Laragon. Then after i checked that my localhost is working properly, i set up my proxy again.
::1 is IPv6 version for 127.0.0.1. to resolve to localhost, try:
edit c:\xampp\apache\conf\httpd.conf and change the Listen 80 to
Listen 127.0.0.1:80 or
disable IPv6 in your adapter or
change virtualhost to
<VirtualHost *:80> or <VirtualHost 127.0.0.1:8080>

CodeIgniter migrate from windows to linux page not found

Well, I have a ubuntu server installed on virtual box running on windows 7.
The virtual machine has 2 adapters set, adapter 1 is host-only meanwhile adapter 2 is NAT. In the NAT adapter, I set up the forwarding port to open the port to outside of the network. So whenever the ip address of the host is typed on browser it will be forwarded to guest ip (Ubuntu server which host a web app). I have a codeigniter folder under /var/www/ and I changed the DocumentRoot in /etc/apache2/sites-available/000-default.conf from /var/www/html to /var/www/codeigniter
Before changing the config file I can access the starting page index.php in /var/www/html from host's browser however when I changed the DocumentRoot to /var/www/codeigniter and typed the ip on host's browser it said the page was not found on the server when it's clearly there.
Note that : the codeigniter origin was from host pc (Windows 7) and I moved to Ubuntu. When downloading the new codeigniter files from ellislab's website it works fine. but it doesnt work with the old codeigniter file from windows
how can I solve this problem ?
Do I need to do something with the virtual host on windows ?

How do I specify a port in url?

I got stuck with this problem
For a temporary solution, I changed the port to 5555 in apache httptd.conf
localhost
shows default index.html content
I integerated php with apache and then started apache by executing httpd.exe
localhost:5555/index.php
says url error How do i achieve this?

Categories