-2

I bought a VPS Host that gave me only 1 IP Address which I used on my first domain name and it works without any problems.

Now my second domain name I can't use the same ip address as it points to the first domain name.

So I figured my only option was to use a GoDaddy hosted iframe redirection which redirects to a sub folder on my first domain which worked so far.

Now I'm trying to load paypal from <?php headers() ?> and I get a permission error because of that iframe

Refused to display 'https://www.paypal.com/cgi-bin/webscr?notify_url=&cmd=_cart&upload=1&business=removed&address_override=1' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

How do I avoid the Iframe solution for my second domain while not messing up my first domain?

Somebody I forgot once told me it doesn't matter if you have 1 IP Address you could host multiple websites on it? how it that possible the DNS doesn't seem to work off ports afaik, yes I could host multiple websites on different folders but that's not what I call hosting a real website it has to be pointed by a domain name, so this iframe issue doesn't happen

My server configuration is httpd (apache) that comes with CentOS 6 (Linux) operating system

10
  • 4
    Voting to close - you miss basic knowledge. For example the fact that you can run multiple sites on one IP since - http 1.1 was around 20 years ago thanks to every request transmitting the domain name. That is basic knowledge - time to read the documentation.
    – TomTom
    May 27, 2014 at 9:26
  • You don't understand how can I run multiple websites pointing on different domains? I tried everything I can't find any answers I did my research only thing I found was iframe redirection by GoDaddy and that's not good.
    – SSpoke
    May 27, 2014 at 9:27
  • Host header separation - depends on which web server you use. It is in every howto. Try including google on your research with so arcane questions like "multiple websites on one ip".
    – TomTom
    May 27, 2014 at 9:28
  • You mean like my domain name can request itself as a folder or something? how can i set this up Can you give me a good link to this
    – SSpoke
    May 27, 2014 at 9:28
  • 1
    Start with google. Tons of tutorials around. I even did the work for you to find a good search term. Was only a second.
    – TomTom
    May 27, 2014 at 9:29

1 Answer 1

2

edit /etc/httpd/conf/httpd.conf, make sure you have "Listen 80" and "NameVirtualHost *:80" in it and add your vhosts. For example:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/example.com/public_html
     ServerName www.example.com
     ServerAlias example.com
     ErrorLog /var/www/example.com/error.log
     CustomLog /var/www/example.com/access.log common
</VirtualHost>

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/site2.com/public_html
     ServerName www.site2.com
     ServerAlias site2.com
     ErrorLog /var/www/site2.com/error.log
     CustomLog /var/www/site2.com/access.log common
 </VirtualHost>

<VirtualHost ipaddress:443>
     ServerAdmin [email protected]
     DocumentRoot /var/www/site2.com/public_html
     ServerName www.site2.com
     ServerAlias site2.com
     ErrorLog /var/www/site2.com/sslerror.log
     CustomLog /var/www/site2.com/sslrequests.log

     SSLProxyEngine on
     SSLEngine on
     SSLCertificateFile /etc/ssl/certs/server.crt
     SSLCertificateKeyFile /etc/ssl/private/server.key
</VirtualHost>

So under your /var/www/ you should have 2 folders example.com and site2.com which are owned by your http deamon.

You better do some research on how to use vhosts as this is a very basic question which doesn't belong here.

7
  • I'll try it out when my DNS gets refreshed in 48 hours hopefully it will work to me I never understood this I thought it worked by IP Addresses and the HOST: in the HTTP request packet was just for security.
    – SSpoke
    May 27, 2014 at 9:44
  • you might want to setup a default entry when someone surfs your IP aswell. May 27, 2014 at 9:47
  • You better lower your dns TTL then for future changes also you can monitor the dns propagation on: whatsmydns.net
    – timmeyh
    May 27, 2014 at 9:47
  • nice website whatsmydns.net is that like a proxy website that goes to your domain from all over the world? how about my first webiste had mod_ssl enabled so I need to do VirtualHost*:443 as well?
    – SSpoke
    May 27, 2014 at 9:52
  • I've updated the post for the vhost with ssl.
    – timmeyh
    May 27, 2014 at 11:08

Not the answer you're looking for? Browse other questions tagged .