I recently reinstalled my whole webserver, and I am now hosting some documents from home for personal use. Now, whenever I go to that page, it automatically downloads the .html and .php documents. I've tried Googling my problems, and no results.
I recently reinstalled my whole webserver, and I am now hosting some documents from home for personal use. Now, whenever I go to that page, it automatically downloads the .html and .php documents. I've tried Googling my problems, and no results.
Probably Apache does not know what to do with the related files (.php i assume) and offers them for download instead of display.
You can check if the following line exists in your site configuration file:
DirectoryIndex index.html index.php
Usually site configurations are stored at /etc/apache2/sites-available
and the enabled configurations (those who actually served by the server) are stored at /etc/apache2/sites-enabled
The rest configuration files, such as apache.conf
and ports.conf:
are stored at /etc/apache2/
directory.
Also the php module must be loaded. There must something like the following in Apache config file:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
AddType application/x-httpd-php .php
If the above settings are missing, you need to add them yourself and issue:
sudo service apache restart
.
For more detailed instructions you can read the Server Guide chapter from the official Ubuntu documentation.