Establishment of Apache virtual host on 12.linux and establishment of HTTPS protocol website

The establishment of a.Apache virtual host
 
Virtual web host
Build multiple web sites on the same server. Each site does not monopolize a real server.
 
    1.Build DNS to resolve two domains with the same IP
    
        vim /etc/name.conf
    
        zone “simplexue.com” IN {
            type master ;
            file “simplexue.com.zone“;
        };
 
        zone “simpleware.com” IN {
            type master ;
            file “simpleware.com.zone“;
        };
 
        vim /var/named/simpelxue.com.zone
        vim /var/named/simpelware.com.zone
 
        $TTL 1D
        @       IN SOA  simplexue.com. allen.simplexue.com. (
                                        2017011901      ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                NS      dns.simplexue.com.
        dns     A       192.168.0.1
        www     A       192.168.0.1
 
    2.Configuring domain name based virtual hosts
    
        vim /etc/httpd/conf/httpd.conf
    
        NameVirtualHost 192.168.0.1:80  Launching domain name based virtual hosts
 
        <VirtualHost 192.168.0.1:80>
                DocumentRoot /var/www/html/simplexue
                ServerName www.simplexue.com
        </VirtualHost>
        <VirtualHost 192.168.0.1:80>
                DocumentRoot /var/www/html/simpleware
                 ServerName www.simpleware.com
        </VirtualHost>
    
    3.Port based virtual host
        
        vim /etc/httpd.conf.httpd.conf
 
            Modify configuration file
 
            Listen 8080                                       Monitor port
            #NameVirtualHost 192.168.0.1:80    Annotate
        <VirtualHost 192.168.0.1:80>
                DocumentRoot /var/www/html/simplexue
                    ServerName www.simplexue.com
        </VirtualHost>
        <VirtualHost 192.168.0.1:8080>
                 DocumentRoot /var/www/html/simpleware
                ServerName www.simplexue.com
        </VirtualHost>
 
 
Two. HTTPS agreement website
 
        
        https establish
 
        1.Perfect the function support of HTTP software SSL
 
            yum groupinstall “web server”
 
        2.Generate private key file
 
            openssl genrsa -out linux.key 1024
 
        3.Create certificate request file
 
            openssl req -new -key linux.key -out linux.csr
             Country abbreviated provinces and cities Department name, hostname, mailbox default carriage return.
        
        4.Create a certificate of your own signature.
 
            openssl x509 -req -days 365 -in linux.csr -signkey linux.key -out linux.crt
        
        5.Edit the SSL configuration file to specify the signature certificate and the location of the private key.
 
            vim /etc/httpd/conf.d/ssl.conf
            SSLCertificateFile      /etc/pki/tls/certs/linux.crt  Self signed certificate location
            SSLCertificateKeyFile      /etc/pki/tls/private/linux.key Private key position
        
        6.Revalidation of previous virtual host functions
 
        Restart http
 
        7.Verification in browser https://192.168.0.1
 

Leave a Reply

Your email address will not be published. Required fields are marked *