Article directory
LinuxHow to change the hostname?
CentOS Web Panel changed hostname
http redirect https
If your linux server, useCWP Control Panel, CentOS changing the hostname (Hostname) is very simple.
- The CWP control panel (CentOS Web Panel) will also enable SSL for the CWP control panel when modifying the hostname.
- The only condition isSet an A record for the domain name.
- Please resolve the domain name to the server IP before the SSL certificate can be generated, otherwise an error will occur.
CWP change hostname method
- The following operations SSL will be installed automatically.
- In the left menu of cwp.admin, go to → CWP Settings → Change Hostname to save your hostname▼
CWP server configuration rebuild
After changing the CWP hostname, the website may become inaccessible, please reset the default web server:
Step 1: On the left side of the CWP Control Panel, click WebServer Settings → Select WebServers ▼
Step 2:Choose Nginx & Varnish & Apache ▼
Step 3:Click the "Save & Rebuild Configuration" button at the bottom to save and rebuild the configuration.
Please Note
Do not delete the CWP folderThe domain name or subdomain of the hostname, otherwise there may be an inaccessible website issue.- If you want to try to delete it, you must make a backup of your website server before deleting it.
http 301 redirect to https
For http:// 301 redirect https:// , please create .htaccess file ▼
/usr/local/apache/htdocs/.htaccess
In the .htaccess file, add the 301 redirect syntax▼
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- To disable redirection, just delete the file.
Manual or custom SSL certificate
You can also use bundlesoftware(If there is),put your own certificatessl_certificateManually replace with certificate :
/etc/pki/tls/certs/hostname.bundle
ssl_certificate_key:/etc/pki/tls/private/hostname.key
Pure FTPd PEM: /etc/pki/tls/private/hostname.pem
Note that the .pem file must contain: key, certificate, chain certificate
This SSL certificate file for CWP ports 2031,2087,2302,2304,2096, XNUMX, XNUMX, XNUMX, XNUMX:
- Admin panel
- user panel
- roundcube
- phpMyAdmin
- phpPgAdmin
- cwp-api
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "How to change the host name in Linux? CentOS Web Panel change hostname to http redirect https", it will help you.
Welcome to share the link of this article:https://www.chenweiliang.com/cwl-654.html
Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!