K
K
kuznetsovin2014-04-18 13:15:04
Apache HTTP Server
kuznetsovin, 2014-04-18 13:15:04

How to set up Apache 2 sites on the same ip?

Good afternoon, colleagues. Need advice on setting up Apache 2.2 on Ububtu 12.04. The situation is as follows: there is a server with Apache installed, it has some external ip (for example, 222.222.222.222). How to configure it so that the server has 2 sites with the following addresses:
- http:// 222.222.222.222:5000 (there will be a certain server)
- http:// 222.222.222.222/subdomain (there will be a Django application on it)
No domain names no. I have never been involved in configuring web servers of this kind of servers.
Tell me, please, how can this be done?
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
svd71, 2014-04-18
@kuznetsovin

NameVirtualHost *:80
<VirtualHost  *:80>
  ServerAdmin [email protected]
  ServerName localhttp
  DocumentRoot /home/svd71/apache/http
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /home/svd71/apache/http/>
Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error_http.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/access_http.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName cms
  DocumentRoot /home/svd71/apache/cms
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /home/svd71/apache/cms/>
Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error_cms.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/access_cms.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName blog
  DocumentRoot /home/svd71/apache/blog
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /home/svd71/apache/blog/>
Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error_blog.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/access_blog.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName bitrix
  DocumentRoot /home/svd71/apache/bitrix
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /home/svd71/apache/bitrix/>
Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error_bitrix.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/access_bitrix.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName homelocal
  DocumentRoot /home/svd71/apache/homelocal
  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /home/svd71/apache/homelocal/>
Options Indexes FollowSymLinks MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error_bitrix.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog ${APACHE_LOG_DIR}/access_bitrix.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

S
svd71, 2014-04-18
@svd71

Set up virtual hosts . There is nothing difficult in this. Will only work when DNS is registered to different domains. When accessed by ip, it will show the first site from the list of virtual domains.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question