How to redirect different sub domain requests to different port

后端 未结 5 443
你的背包
你的背包 2021-01-30 07:19

I have two applications, one is the www.myexample.com, another is the blog.myexample.com. I am using PHP and Apache.

Now, I want to let w

5条回答
  •  被撕碎了的回忆
    2021-01-30 08:04

    Run the following line on terminal (specify your domain and sub domain name correctly)

    sudo nano /etc/apache2/sites-available/subdomain.domain.com.conf 
    

    Paste the following code and change as your requirement

    
            ServerAdmin admin@domain.com
            ServerName subdomain.domain.com
            ServerAlias subdomain.domain.com
            ProxyRequests Off
    
            #ProxyPass / http://localhost:8080/
            
                    ProxyPreserveHost On
                    ProxyPass http://domain.com:8080/
                    ProxyPassReverse http://domain.com:8080/
            
         # Uncomment the line below if your site uses SSL.
         #SSLProxyEngine On
    
    

    Run the following lines on terminal (specify your domain and sub domain name correctly)

    sudo a2enmod proxy
    sudo a2enmod proxy_http
    sudo a2enmod subdomain.domain.com.conf
    sudo service apache2 restart
    

提交回复
热议问题