The requested URL /index.php was not found on this server.? - php

I have an online Ubuntu VPS (with Plesk already installed), I tried a very simple index.php script in the /var/www/html directory using the IP address of the server in the browser ex. 123.123.123.133/index.php, but the response was always (The requested URL /index.php was not found on this server.)
the script was:
<?php
phpinfo();
?>
I restarted apache2 many times and I tried many of the solutions in the stack overflow but none of them worked for me.
any help with this issue??

Check the directory where Plesk serves its files from. Is that really /var/www/html? I thought Plesk was using /var/www/vhosts/<domain_name>.
Plesk documentation

Related

Htaccess giving 404 error on Aws Linux 2 AMI

I have set up an elastic beanstalk and deployed my application to it, the application has a .htaccess file in it. .htaccess works perfectly on my localhost but when checking it on the live server it gives back a 404 error.
For Example
I have a login file named login_1.php, on my .htaccess I've set the file to be called login.
When clicking the login link on my localhost it sends me to the login_1.php file with the URL name of login, but when clicking on the login link on the live server it takes me to a 404 error.
I've followed all instructions on the internet regarding this issue but nothing seems to solve the problem. I've changed AllowOverride None to AllowOverride All on my httpd.conf file. I do not have apache on my ec2 Linux 2 AMI instance so I can't restart apache.
Any help would be much appreciated to fix this.
Thanks,
Arnav
Figured out the answer, went into my elastic beanstalk application and changed the application type to APACHE instead of NGINX. This start httpd sever and allowed me to activate the .htaccess file in my application.

"404 Not found" error for my web page in LAN with lampp server on ubuntu

I have setup a small website to access in our college LAN via LAMPP server installed on UBUNTU 14.04 LTS. Its a simple application containing few html and php pages, with database as mysql at back-end.
When we try to access this website in LAN, sometimes we get access to website correctly, where as sometimes we get "404 NOT FOUND" error.
Its completely unpredictable when we will get access and when we wont.
Is it a network issue? or what? We are clueless.
Can somebody help....
Had the exact same problem a week ago is there any files in the C:\wamp64\www directory, not sure what it is in Linux... Find the below text area in the httpd.conf file, found in C:\wamp64\bin\apache\apache2.4.18\conf for Windows, and add your index page where i put my publish.htm page
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex publish.htm index.php
</IfModule>

Owncloud not available after installation on Ubuntu server 14.04

With the goal to install owncloud (version 6.0.3-0) on my ubuntu server (14.04), I followed this guideline:
http://doc.owncloud.org/server/6.0/admin_manual/installation/installation_source.html
After having this completed, the /var/www/owncloud folder exists with the following content:
3rdparty core index.html occ robots.txt themes apps cron.php index.php ocs search version.php config data l10n public.php settings console.php db_structure.xml lib remote.php status.php
Visiting
http://localhost
results in a site like this: https://assets.digitalocean.com/articles/lamp_1404/default_apache.png indicating, that the apache-server works.
Visiting
http://localhost/owncloud
leads to server error 404: "Not Found".
Meanwhile, I tried the installation (owncloud 6.0.3-0) on my laptop (Ubuntu 13.10) to compare results. Skipping the above guidelines, just installing owncloud using the package-manager works out of the box, while the content of /var/www/owncloud results only in config data
Since it works on my laptop, I have the suspect, that I screwed up some configuration on my ubuntu server. Even so, reinstalling apache2 (including purge) did not help.
Do you have any ideas, where to start over?
This is because Apache 2.4's default web root is /var/www/html as opposed to /var/www. ownCloud's default installation ends up in /var/www/owncloud, which is outside of the web root.
I first solved this by creating a symbolic link at /var/www/html/owncloud, but I found it cleaner to simply change Apache's document root to /var/www/owncloud. If you want to preserve the owncloud subdirectory, you can point it to /var/www and get rid of /var/www/html and its contents.
Edit /etc/apache2/sites-enabled/000-default.conf (and/or the appropriate configuration for the SSL site in the same location, depending on your setup) to point DocumentRoot to /var/www or /var/www/owncloud, whichever works for you.
I just figured this out myself, so it may warrant further configuration changes. I will update this post if/when I figure out more tweaks need to be made, but it seems to be working for me, anyway.
Also this has nothing to do with programming and really belongs on superuser.com or perhaps serverfault.com.
This would be more appropriate as a comment as I'm completely clueless as to the solution, but the strange system of SO doesn't allow me to post comments. I have an idea that may not help but just want to confirm that it's not the problem.
Have you tried the following URL?
http://localhost/owncloud/index.html
The first thing that came to mind is that there is a problem with your Default Document settings.
If the above works, you can fix it so you don't have to define the HTML file in the URL by creating a .htaccess file in your server root directory with the contents being:
DirectoryIndex index.php index.html index.htm default.html default.htm home.html
Hope this helps.

php web application and strange 404 error (something wrong with Apache ?)

I have downloaded a php web application from the web (OntoWiki).
After the installation I've tried it and it works fine on my Ubuntu 10.10, but when I try to install it on CentOS Linux, the only page that works is the home page (index.php).
If i try to change the page, the browser sends me a 404 error page (page not found).
Instead if i try to change the URL with the "index.php" as prefix it works fine.
Example:
localhost/app/index.php/directory -> works
localhost/app/directory -> doesn't work (404 error)
Why does this happen? On the PC where the program works i have the URL like: host/application but everything works fine.
Is there an Apache Configuration problem?
Thanks in advance
Check you have mod_rewrite enabled on your CentOS server.
Active the Apache rewrite module:
a2enmod rewrite
Restart Apache.
In an application like OntoWiki, all requests are directed through index.php. An .htaccess file accompanies the project including RewriteRule's to map a path like /directory to /index.php/directory.
Apache's mod_rewrite module must be installed and enabled for the host in order for the RewriteRules to be applied. It sounds like you have it disabled on your CentOS box and enabled locally.

PHP does not work over ssl connections

I just got my ssl certificate to work for the first time.
For some reason when I connect to my website using https my browser tries to download the php file.
I have the following line in my httpd.conf. Isn't this the line which makes sure php files are run using php?
AddType application/x-httpd-php .php
What else do I need to change so that I can get the php files to work over the https connection.
Thanks!
UPDATE:
httpd.conf:
Removed...
The problem was somehow with Plesk. This dedicated server came with plesk pre-installed. I never used it so far but it turns out it was overriding my ssl.conf somehow.
So the solution was creating my domain under plesk. Moving all files to the new directory created by plesk. Embedding my ssl certificate to plesk and associating the certificate with the domain.
Now it is working like a charm. I cannot say I'm happy that I have to start learning Plesk but at least it is working.

Categories