Ubuntu lamp solves the coexistence problem of 2 websites

Source: Internet
Author: User
Keywords Ubuntu lamp coexistence problem
Tags access aliyun bind coexistence coexistence problem connected default different

Little brother Contact Lamp not long time, many things are their own 1.1 point groping, a lot of problems hope to make friends
The following 2 scenarios certainly have security issues, and I hope you will criticize that the following scenarios are for informational purposes only.

Programme 1:

Different IP addresses with different sites
Bind the 2nd IP to the NIC:
The two network cards are named Eth0 and eth1 respectively. Where the eth0 is connected to the extranet. IP for 202.118.21http://www.aliyun.com/zixun/aggregation/37104.html ">0.121
This requires adding a virtual NIC eth0:0 and binding IP202.118.210.124
Ludaxing@linux:/$sudo vi/etc/network/interfaces

Add Auto eth0:0
Iface eth0:0 inet Static
Address 202.118.210.124
Netmask 255.255.255.128
Receptacle 202.118.210.0
Broadcast 202.118.210.127
Gateway 202.118.210.126

Modify Apache2 Virtual host settings
ludaxing@linux:/$ sudo vi/etc/apache2/ports.conf
Modify the contents of the inside
Listen 80
Namevirtualhost 202.118.210.121:80
Namevirtualhost 202.118.210.124:80

<virtualhost 202.118.210.121:80>
ServerName www.example.com
Documentroot/var/www/server1
</VirtualHost>

<virtualhost 202.118.210.124:80>
ServerName www.example2.com
Documentroot/var/www/server2
</VirtualHost>

Restart receptacle and Apache. Make configuration effective.

Programme 2:

Through the Apache virtual directory function to achieve
Add the following to the virtual machine settings
Alias/server2 "/var/www/server2"
<directory "/var/www/icons" >
Options Indexes MultiViews
AllowOverride None
Order Allow,deny
Allow from all
</Directory>

Content attributes

1.Options: Defining directory Attributes
Indexes allows directory browsing (browse directory files)
MultiViews multiple views allowing content negotiation (full file name)
All features except MultiView (if no options, default to All)
EXECCGI allows CGI scripts to be executed
Recursively allows server-side include functionality
IncludesNOEXEC allows server-side include functionality, but does not support CGI

2. Set the directive type in the. htaccess file.
Alllowoverride None (set directly in the configuration file without using Htacces)

3. Processing order of access rights
Order Allow,deny: Disable all client access by default
Order Deny,allow: All clients are allowed access by default

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.