Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, all I want to config "phpmyadmin" site with https. But it works on port 65533 instead of the default 443. This is my configuration: Code: LoadModule rewrite_module modules/mod_rewrite.so listen ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2005
    Location
    China
    Posts
    37

    Question http to https rewrite rule of apache


    Hi, all
    I want to config "phpmyadmin" site with https. But it works on port 65533 instead of the default 443.
    This is my configuration:
    Code:
    LoadModule rewrite_module modules/mod_rewrite.so
    listen 65533
    <VirtualHost *:65533>
    DocumentRoot /var/www/phpMyAdmin2
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/cert.crt
    SSLCertificateKeyFile /etc/pki/tls/certs/key.key
    RewriteEngine On
    RewriteCond %{SERVER_PORT} ^65533$
    RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1[L,R]
    </VirtualHost>
    But it doesn't work, maybe there's something wrong with the rewriterule. Any ideas? Thanks a lot.

  2. #2
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    this should be defined in your port 80 virtual host container. you want to be able to hit http://yoursite.com and be redirected to https://yoursite.comort#

    so you have to grab the request at the http level. I am guessing that is what you want from your title.

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Location
    India
    Posts
    23

    Redirect..

    Quote Originally Posted by phoenic View Post
    Hi, all
    I want to config "phpmyadmin" site with https. But it works on port 65533 instead of the default 443.
    This is my configuration:
    Code:
    LoadModule rewrite_module modules/mod_rewrite.so
    listen 65533
    <VirtualHost *:65533>
    DocumentRoot /var/www/phpMyAdmin2
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/cert.crt
    SSLCertificateKeyFile /etc/pki/tls/certs/key.key
    RewriteEngine On
    RewriteCond %{SERVER_PORT} ^65533$
    RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1[L,R]
    </VirtualHost>
    But it doesn't work, maybe there's something wrong with the rewriterule. Any ideas? Thanks a lot.

    Redirect rule can be used in .htaccess file to redirect url. The way I can suggest you is to change the <VirtualHost *:65533> to <VirtualHost *:443>. Make sure under /etc/services file below 2 lines are present,

    https 443/tcp # MCom
    https 443/udp # MCom


    Hope this helps..

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Sep 2005
    Location
    China
    Posts
    37
    Quote Originally Posted by jaijai View Post
    Redirect rule can be used in .htaccess file to redirect url. The way I can suggest you is to change the <VirtualHost *:65533> to <VirtualHost *:443>. Make sure under /etc/services file below 2 lines are present,

    https 443/tcp # MCom
    https 443/udp # MCom


    Hope this helps..
    Unfortunatily, there's another site runs on port 443, the rewrite works well. the rewriterule is:
    Code:
    	RewriteEngine on
    	RewriteCond %{SERVER_PORT} !^443$
    	RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]
    And I don't want the mysql administration site open to the public. But thank you all the same. I guess there must be a http virtual host works on 65533 to make the rewrite-rule work, even it's an empty folder. But the APACHE doesn't allow me to create 2 sites on the same port

  6. #5
    Just Joined!
    Join Date
    Sep 2005
    Location
    China
    Posts
    37
    Quote Originally Posted by jledhead View Post
    this should be defined in your port 80 virtual host container. you want to be able to hit http://yoursite.com and be redirected to https://yoursite.comort#

    so you have to grab the request at the http level. I am guessing that is what you want from your title.
    I want to visit the "phpmyadmin" through the url "http://domainname:65533", and then the url will be rewrited to "https://domainname:65533" automatically by Apache2.
    Now there's a "https" site works on port 65533, When I type "domainname:65533" in the browser, the browser would add "http://" head automatically. Of course, the "Apache2" returns me an error page like this:
    Code:
    Bad Request
    
    Your browser sent a request that this server could not understand.
    Reason: You're speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.
    
        Hint: https://domainname:65533/
    Any suggestions are welcome. Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •