LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Setting up a virtual host on apache for SagePay integration - advice for a novice! (https://www.linuxquestions.org/questions/linux-software-2/setting-up-a-virtual-host-on-apache-for-sagepay-integration-advice-for-a-novice-746766/)

lauriedunsire 08-11-2009 11:58 AM

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.

Wim Sturkenboom 08-11-2009 01:47 PM

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.

lauriedunsire 08-12-2009 07:31 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 3639559)
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.

Wim Sturkenboom 08-12-2009 10:34 AM

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.

lauriedunsire 08-13-2009 04:16 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 3640534)
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!

Wim Sturkenboom 08-13-2009 04:54 AM

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?

lauriedunsire 08-13-2009 05:36 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 3641588)
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?


All times are GMT -5. The time now is 05:51 AM.