Basic Apache help needed

Soldato
Joined
18 May 2010
Posts
22,943
Location
London
Hi guys.

My first go at getting a website to run in Apache.

I'm trying to deploy GLPI. Both for training purposes and for deploying at work.

I've set up a LAMP server running on Centos.

The test page works for Apache.

I copied the GLPI directory with all the files to the /var/www/html/glpi directory

When I browse to localhostip/glpi it just lists the content of the directory rather than launching the page.

I get the feeling I haven't install php properly. It's installed (yum install php php-mysql) but I get the feeling it's not working properly because surly by browsing to that directory should launch site not give me a directory listing.

Have I put the files in to the right directory to begin with?

The documentation just says:

Install the application files on the server

Install the application files on the server to host GLPI.
Unzip the downloaded archive. The directory name is obtained glpi.
Copy this directory in the web tree of files to make it accessible..
Give write access to the web service on the folders /files and /config.

I also dont know what to do for the last line. what would the username be of the web service?
 
Last edited:
create a .php file with

Code:
<?php
phpinfo();
?>

browse to it and see

if that works then you're probably not redirecting properly with mod_rewrite

quick google picks up http://linuxadmin.melberi.com/2010/07/glpi-installation-guide-step-by-step.html which includes steps for the httpd.conf file, might be a bit dated but seems to include more info than one you've followed.

also www-data or apache is the typical username for apache you can run "cat /etc/passwd" to list the users


I got stuck. :p In the following that guide you linked too I got up to restarting the apache service and it fails.

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

If I run: systemctl status httpd.service -l

I get:

May 22 15:29:37 centos7.andrew.com systemd[1]: Starting The Apache HTTP Server...
May 22 15:29:37 centos7.andrew.com httpd[29121]: httpd: Syntax error on line 356 of /etc/httpd/conf/httpd.conf: /etc/httpd/conf/httpd.conf:366: <> was not closed.\n/etc/httpd/conf/httpd.conf:364: <> was not closed.\n/etc/httpd/conf/httpd.conf:362: <> was not closed.\n/etc/httpd/conf/httpd.conf:356: <> was not closed.
May 22 15:29:37 centos7.andrew.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 22 15:29:37 centos7.andrew.com kill[29136]: kill: cannot find process ""
May 22 15:29:37 centos7.andrew.com systemd[1]: httpd.service: control process exited, code=exited status=1
May 22 15:29:37 centos7.andrew.com systemd[1]: Failed to start The Apache HTTP Server.
May 22 15:29:37 centos7.andrew.com systemd[1]: Unit httpd.service entered failed state.
May 22 15:29:37 centos7.andrew.com systemd[1]: httpd.service failed.


Then I ran this: apachectl configtest

and it tells me:

httpd: Syntax error on line 356 of /etc/httpd/conf/httpd.conf: /etc/httpd/conf/httpd.conf:366: <> was not closed.\n/etc/httpd/conf/httpd.conf:364: <> was not closed.\n/etc/httpd/conf/httpd.conf:362: <> was not closed.\n/etc/httpd/conf/httpd.conf:356: <> was not closed.


The <VirtualHost> entry I added as shown in the example I just added to the end of the httpd.conf file. Was this incorrect?
 
I removed this:

< VirtualHost 192.168.1.89:* >
DocumentRoot /var/www/html/glpi
ServerName support.example.com
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
< Directory "/var/www/html/glpi" >
DirectoryIndex index.php
< /Directory >
Options ExecCGI
< /VirtualHost >

from the end of the httpd.conf file and then ran apachectl configtest and it returns successful.

So the question is, where do I put the above?

* And the service is now restart-able.
 
Woo success!!

---

Yep all working.

Thanks!!

I had to disable SELiux and add some exceptions in to get it to work.

setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_connect_db on
setsebool -P httpd_can_sendmail on

Is this a normal thing in a production environment or should I of really got it working with SELinux on?
 
Last edited:
Back
Top Bottom