Last time I’ve been working on my WordPress installation security. I added a few layers of high-level-security-paranoia. One of those was moving admin-panel to another TCP port (this was because I got only 1 public IP addr on this VPS and that means only one SSL legit certificate on 443 port. So – each SSL webservice on my server is now binded to a different TCP port and those are ‘SSL green’ ;) ).
Running admin panel over SSL is a thing which has already been described on a many websites:
- http://codex.wordpress.org/Administration_Over_SSL
- http://www.wpbeginner.com/wp-tutorials/how-to-secure-your-wordpress-pages-with-ssl/
- http://support.godaddy.com/help/article/6922/using-an-ssl-with-your-wordpress-admin-control-panel
But I haven’t found any article about running Admin Panel over SSL on different port than the website. So I took a deep dive (oh not that deep) into WordPress code and found, that it’s really that simple ;) Assuming my admin panel is running on TCP/445 port and website is as usual on TCP/80 all i had to do was this chunk of PHP code (maybe not that clean, but it’s just working fine) – put it in wp-config.php file:
1 2 3 4 5 |
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' && isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']==445) { define('WP_HOME','https://maciek.lasyk.info:445/sysop'); define('WP_SITEURL','https://maciek.lasyk.info:445/sysop'); } |
References: