Setting up a virtual host on apache for SagePay integration - advice for a novice!
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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> 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.
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
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
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
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?
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.
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.
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?
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.