web server issue urgent help

General support questions
Post Reply
Posts: 1
Joined: 2014/07/26 10:51:31

web server issue urgent help

Post by demo7user » 2014/07/26 11:18:38

Hello Guys,

I'm having centos server in amazon ec2 with one public ip,

I need to host multiple domain on that server, First of all I created two user 1st is example1 and 2nd example2 for example1.com & example2.com.
created directory under /var/www/example.com/public_html for example1.com & /var/www/example2.com/public_html
and /var/www/html/index.html holding php.info file for if user type only ip in browser php details should be accessible..

now httpd.conf configuration
domain is listening on Listen 80 & NameVirtualHost *.80

<VirtualHost *:80>
ServerAdmin webmaster@example1.com
ServerName www.example1.com
ServerAlias example1.com
DocumentRoot /var/www/example1.com/public_html
ErrorLog /var/www/example1.com/error.log
CustomLog /var/www/example1.com/access.log common

<VirtualHost *:80>
ServerAdmin webmaster@example2.com
ServerName www.example2.com
ServerAlias example2.com
DocumentRoot /var/www/example2.com/public_html
ErrorLog /var/www/example2.com/error.log
CustomLog /var/www/example2.com/access.log common

Main problem arises from here..
When I type example2.com in browser it works fine

but issue is when I type example1.com in browser it's work fine and displaying site also, but if I type public IP of server it displays example1.com site instead of phpinfo file..

httpd -S result

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 ip-X-X-X-X.eu-west-1.compute.internal (/etc/httpd/conf.d/ssl.conf:74)
*:80 is a NameVirtualHost
default server www.example1.com (/etc/httpd/conf/httpd.conf:1013)
port 80 namevhost www.example1.com (/etc/httpd/conf/httpd.conf:1013)
alias example1.com
port 80 namevhost www.example2.com (/etc/httpd/conf/httpd.conf:1022)
alias example1.com
Syntax OK

Posts: 13
Joined: 2014/07/16 02:00:48
Location: West Lafayette, IN, USA

Re: web server issue urgent help

Post by Don » 2014/07/27 03:01:19

According to the comments in an unmodified httpd.conf file:

Code: Select all

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
With that in mind, why can't you just insert a 3rd virtual host before your 2 existing virtual hosts?

Code: Select all

<VirtualHost *:80>
ServerAdmin webmaster@whatever.com
ServerName W.X.Y.Z
DocumentRoot /var/www/html
ErrorLog /var/www/whatever/error.log
CustomLog /var/www/whatever/access.log common
Where W.X.Y.Z is your IP address? (Or even a dummy name like http://www.example.com, but I think the IP address would be best if it works.)


User avatar
Posts: 839
Joined: 2006/12/30 03:00:04
Location: Western Slope Colorado

Re: web server issue urgent help

Post by vonskippy » 2014/07/27 03:12:21

You're hosting on a PUBLIC cloud service with PUBLIC IP with PUBLIC domain names, yet you've obfuscated your "example" on a forum you've come to for help so much who can tell what.

Security thru Obscurity is a myth.

If you want help, post enough REAL INFO so that others can test and see what's wrong.
For the 2.5^15th time :: Better Details = Better Answers

Post Reply

Return to “CentOS 6 - General Support”