Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am new to Linux (CentOS) and have been trying to setup up this web application https://github.com/craigrodway/printmaster on CentOS for the last couple hours.

The instruction from the author is a bit vague for a newbie like me:

  • Create directory on webserver to store files (configure as virtual host or subdir)
  • Copy all Print Master files to the folder you just created
  • Create a new directory called session where you extracted the files and make it writeable
  • Create a new username and database in MySQL
  • Import the printmaster.sql file into the new database
  • Edit the $db line in inc/init.php to reflect your database details Invent your own security (.htaccess, integrated Windows authentication...)

I try to follow the instruction from guide in the wiki section but still could not get it to work: https://github.com/craigrodway/printmaster/wiki/Installation-on-Linux

Here is a history of what I did

  1. Installed / configured Apache Server following this instruction: http://dev.antoinesolutions.com/apache-server (Visited localhost in the web browser and saw an Apache Test Page)
  2. Installed / configured PHP following this intruction: http://dev.antoinesolutions.com/php (Visited localhost/phpinfo in the web browser, and there's the phpinfo output. So it works!)
  3. Installed / configured MySQL

--- FILES ---

[root@localhost ~]# cd /tmp
[root@localhost ~]# wget [url]
https://github.com/craigrodway/printmaster/tarball/master[/url] --no-check-certificate
[root@localhost ~]# tar zxvf master
[root@localhost ~]# mv craigrodway-printmaster-af9843d/* /root/Desktop/printmaster/

Created 'session' directory is in the printmaster directory, made it writable

[root@localhost ~]# mkdir session
[root@localhost ~]# chmod 755 session

--- DATABASE ---

mysql -u root -p

(enter the password for root user)

mysql> CREATE USER 'printers'@'localhost' IDENTIFIED BY 'printersPASS';
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE DATABASE printers;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON printers.* TO 'printers'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> quit;

--- IMPORT SQL FILE ---

Import the printmaster.sql as instructed

[root@localhost ~]# mysql -u root -p printers < printmaster.sql

Open init.php and edit the $db line

[root@localhost ~]# vi inc/init.php

Change $db to:

$db = new fDatabase('mysql', 'printers', 'printers', 'printersPASS', 'localhost');

--- Now I set up VirtualHost on httpd --- First of all, do I even need to set up virtual host?

Created the file /etc/httpd/conf.d/testprintmaster.conf with the following text:

<VirtualHost *:80>
  DocumentRoot /root/Desktop/printmaster
  ServerName testprintmaster
  ServerAlias [url]www.testprintmaster.com[/url]
</VirtualHost>

Restart Apache

[root@localhost ~]# service httpd restart

--- RESULT ---

That's it! But when I visit www.testprintmaster.com on firefox, Apache directs it to a search page ... WTF!?

I check the syntax check on VirtualHost configuration

[root@localhost ~]# /usr/sbin/httpd -S

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443   localhost.localdoman (/etc/httpd/conf.d/ssl.conf:81)
*:80        is a NameVirtualHost
    default server testprintmaster (/etc/httpd/conf.d/testprintmaster.conf:2)
    port 80 namevhost testprintmaster (/etc/httpd/conf.d/testprintmaster.conf:2)
Syntax OK

What did I do wrong? Any idea?

share|improve this question

migrated from stackoverflow.com Apr 25 '12 at 23:34

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Why are you visiting www.printmaster.com? It sounds like you're configuring your server locally, so you should make sure testprintmaster resolves to your localhost (i.e. ping testprintmaster succeeds). If it doesn't you should add 127.0.0.1 testprintmaster record to /etc/hosts and then try accessing it via http://testprintmaster.

share|improve this answer
    
+1 (in 50 minutes when I have votes again). This is correct. Op needs to add the domain to the hosts file to be able to access it. Or not use a vhost at all and just access http://localhost –  drew010 Apr 25 '12 at 23:12
    
BluesRock, 'www.printmaster.com' was a typo. I actually tried 'testprintmaster' and it re-directed me a search page. I also try to add 127.0.0.1 testprintmaster to /etc/hosts. It returns this message " Forbidden you don't have permission to access / on this server. Apache/2.2.3 (CentOS) Server at testprintmaster Port 80" –  user118796 Apr 26 '12 at 14:14
    
I followed drew00 suggestion and not use VirtualHost and it works. But Eventually I need to set up VirtualHost because apache will be serving multiple services. –  user118796 Apr 26 '12 at 15:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.