Sandeep Chatterjee
Sandeep Chatterjee

Reputation: 3249

Deploying web-application on apache2 server

I have installed/setup PHP5 and Apache2 server on Ubuntu and trying to deploy a dummy project on it.

enter image description here

The server is up and running.but the URL http://localhost/DemoWebApp gives me

Apache/2.4.7 (Ubuntu) Server at localhost Port 80.

enter image description here

What am I doing wrong or how do I set it up correctly?

Edit:

Project structure:

enter image description here

Upvotes: 3

Views: 20086

Answers (5)

willyMon
willyMon

Reputation: 639

add the following lines inside the httpd.conf file

<FilesMatch \.php$>
        SetHandler application/x-httpd-php
</FilesMatch>

It is just to set the handler for the php files. make sure that in this file you have enabled PHP Module i.e.

LoadModule php5_module /opt/homebrew/opt/[email protected]/lib/httpd/modules/libphp5.so

Upvotes: 0

Bogdan Kuštan
Bogdan Kuštan

Reputation: 5577

Set DocumentRoot in /etc/httpd/httpd.conf to /var/www or move DemoApp folder to /var/www/html

Upvotes: 1

Nimrod007
Nimrod007

Reputation: 9913

move DemoWebApp into html folder and it should work

Upvotes: 2

Technopolice
Technopolice

Reputation: 497

Looks like you have not configured the DemoApp properly. Check the files inside DemoApp folder. Also make sure that your app is running on Port 80. Because if the app is running at some other port ( and not the default port 80), then this might occur.

Once everything is set, restart apache.

sudo service apache2 restart

EDIT (After seeing your files in the DemoApp folder) Another problem could be index.php not being loading/ recognized by server. Check in httpd.conf, (sometimes just index.html will be recognized as default index file.). If it is not set to be the default index file, add the following lines in httpd.conf

<Directory /DemoApp>
DirectoryIndex index.php
</Directory>

Another approach is create a .htaccess file and add the below line:

DirectoryIndex index.html index.php

Upvotes: -1

terary
terary

Reputation: 1108

I dont have ubuntu handy - httpd -S see if you get the virtual host listed.

I am assuming the localhost (no directory)- does what it should

It looks like your directory is not configured correctly

Upvotes: 0

Related Questions