LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-11-2009, 10:58 AM   #1
lauriedunsire
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Rep: Reputation: 0
Question Setting up a virtual host on apache for SagePay integration - advice for a novice!


As the title says I need to set up a virtual host on apache, and first of all I'm not sure whether I even can if the site in question is hosted by Fasthosts, and secondly how would I go about it if I can.

I'm integrating a payment system - something that has been given me a huge amount of grief and I've previously discussed on this forum - and this time around it is for SagePay and the instructions are as follows;

Code:
Set up a virtual host in Apache where you will run the kit from. To do this, open the httpd.conf file in an editor. At the very bottom of this file is a Virtual Hosts section. 

Add a new virtual host in accordance with your local set-up. For example if you were creating a directory called SagePayFormKit on php:
<VirtualHost 127.0.0.1>
ServerName SagePayFormKit
DocumentRoot /www/htdocs/SagePayFormKit
</VirtualHost>


Also in the httpd.conf file, add welcome.php as a default document in the <IfModule mod_dir.c&gt section. For example:
<IfModule mod_dir.c>
DirectoryIndex index.htm index.html index.php default.html welcome.php
</IfModule>


Ensure that your root folder is accessible to the Apache program. This requires that the folder belongs to a non-privileged user.
Any advice would be much appreciated!

Cheers,

Laurie.
 
Old 08-11-2009, 12:47 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
It depends slightly on the distro which files it uses for the apache configuration. It will be safe to add
Code:
<VirtualHost 127.0.0.1>
ServerName SagePayFormKit
DocumentRoot /www/htdocs/SagePayFormKit
</VirtualHost>
at the end of the apache config (probably httpd.conf, probably in /etc/httpd or /etc/apache).
Modify the bold line so it reflects where you have installed your SagePay. Also be aware that clients need to be able to resolve the servername.

Further run a grep -r DirectoryIndex * on the above mentioned possible directories in /etc. This will give you the file (hopefully one) where DirectoryIndex is set. Edit that file and modify the line so it matches
Code:
DirectoryIndex index.htm index.html index.php default.html welcome.php
If you find multiple files, you have to analyze.

The permissions are usually not an issue (755 for each directory leading to SagePayFormKit should do).

You should be able to access it now from a browser with the url http://SagePayFormKit

Note:
I don't know what SagePay exactly is, but if the user has to enter confidential information, you need to setup your system using https instead of http. Unless you want the whole world to be able to snif e.g. creditcard details.

Hope this gets you on the way


PS If you tell us the distro, someone with specific knowledge of apache configuration on that distro might be able to give tailored advice.

Last edited by Wim Sturkenboom; 08-11-2009 at 12:52 PM. Reason: added ps
 
Old 08-12-2009, 06:31 AM   #3
lauriedunsire
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Wim Sturkenboom View Post
It depends slightly on the distro which files it uses for the apache configuration. It will be safe to add
Code:
<VirtualHost 127.0.0.1>
ServerName SagePayFormKit
DocumentRoot /www/htdocs/SagePayFormKit
</VirtualHost>
at the end of the apache config (probably httpd.conf, probably in /etc/httpd or /etc/apache).
Modify the bold line so it reflects where you have installed your SagePay. Also be aware that clients need to be able to resolve the servername.

Further run a grep -r DirectoryIndex * on the above mentioned possible directories in /etc. This will give you the file (hopefully one) where DirectoryIndex is set. Edit that file and modify the line so it matches
Code:
DirectoryIndex index.htm index.html index.php default.html welcome.php
If you find multiple files, you have to analyze.

The permissions are usually not an issue (755 for each directory leading to SagePayFormKit should do).

You should be able to access it now from a browser with the url http://SagePayFormKit

Note:
I don't know what SagePay exactly is, but if the user has to enter confidential information, you need to setup your system using https instead of http. Unless you want the whole world to be able to snif e.g. creditcard details.

Hope this gets you on the way


PS If you tell us the distro, someone with specific knowledge of apache configuration on that distro might be able to give tailored advice.
Thanks for the reply, it is Red Hat Enterprise Linux. I am still a little confused about how I access the 'httpd.conf' apache file. I can't see this or any directories when I access the site. Do I need further access than the FTP I am provided with?

Thanks.
 
Old 08-12-2009, 09:34 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Yes, you need more than FTP.

FTP probably will use a 'jail' so you can only see a certain directory (the document root or one level higher). You need SSH access so you can edit the apache configuration files and you need to be able to become the root user. If this is a dedicated server you should not have a problem getting it; if it's a shared server, chances are slim that you will be able to get it.
 
Old 08-13-2009, 03:16 AM   #5
lauriedunsire
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Wim Sturkenboom View Post
Yes, you need more than FTP.

FTP probably will use a 'jail' so you can only see a certain directory (the document root or one level higher). You need SSH access so you can edit the apache configuration files and you need to be able to become the root user. If this is a dedicated server you should not have a problem getting it; if it's a shared server, chances are slim that you will be able to get it.
I was afraid you were going to say that. I'm getting really frustrated now as the reason SagePay was brought in was because the HSBC payment system my client is signed up for required access that I couldn't get on the Fasthosts shared server, and SagePay was the solution advised for her that would act as the 'go-between' as there isn't any payments or payment details to be taken on the site in question, everything is happening through the SagePay/HSBC sites.

I'm going to have to call them I think!
 
Old 08-13-2009, 03:54 AM   #6
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
and SagePay was the solution advised for her that would act as the 'go-between'
Maybe I'm missing something, but to configure a virtual host, you need root access. A virtual host is basically a second website on the same server.

I did a little snooping around. Which SagePay product are you using? From you opening post I understand it's the FormKit which is advised for shared hosting ( http://www.sagepay.com/developers/in...troduction.asp ). So SagePay should know that there's a chance that you don't have the option to setup a virtual host (or do any other configuration); so the reference to the virtual host that you've quoted does not make sense.

I assume that you have your own server for testing purposes. If so, have you installed the SagePay stuff on there? If so, can you provide a directory listing so we can see what is installed.

You might be able install the files in a subdirectory of the documentroot if it does not require anything special.

I'm also curious about the FTP access. Can you give a directory listing after you connected to the FTP server?
 
Old 08-13-2009, 04:36 AM   #7
lauriedunsire
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Wim Sturkenboom View Post
Maybe I'm missing something, but to configure a virtual host, you need root access. A virtual host is basically a second website on the same server.

I did a little snooping around. Which SagePay product are you using? From you opening post I understand it's the FormKit which is advised for shared hosting ( http://www.sagepay.com/developers/in...troduction.asp ). So SagePay should know that there's a chance that you don't have the option to setup a virtual host (or do any other configuration); so the reference to the virtual host that you've quoted does not make sense.

I assume that you have your own server for testing purposes. If so, have you installed the SagePay stuff on there? If so, can you provide a directory listing so we can see what is installed.

You might be able install the files in a subdirectory of the documentroot if it does not require anything special.

I'm also curious about the FTP access. Can you give a directory listing after you connected to the FTP server?
I'm really getting myself confused now. Unfortunately I don't have any dedicated servers, I use shared servers myself as generally I design pretty straightforward sites that don't require further access. So please forgive my ignorance as I'm not much of a coder, I generally use PHP and just install scripts by instructions and then modify and customise them as required.

OK I've spoken to SagePay and they are getting back to me as the guy wasn't even sure if I can get around this or not. But I've uploaded everything just by FTP and currently it all appears ready to install. However I don't want to do this if everything will go to pot because I've not modified the file on the Apache server. I'm going to once again ask what is no doubt a stupid question, but why do I need to make these changes and add a virtual host on the apache side? Surely this must be more simple than that if all it is doing is acting as a shopping cart and then taking the user to the SagePay website?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache virtual host liang3391 Linux - Server 1 07-03-2009 10:23 PM
setting up name based virtual host on lan shanecaldeiro Linux - Newbie 9 05-22-2009 04:53 PM
Setting up apache virtual host in redhat linux chu2654 Linux - Server 4 02-28-2008 10:20 PM
Setting up a virtual host zupidupi Linux - Networking 2 01-30-2005 08:58 AM
Setting up webalizer for virtual host hct224 Linux - Newbie 18 11-10-2004 03:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration