How to change the hostname in Linux? CentOS Web Panel change hostname http redirect https

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▼

How to change the hostname in Linux? CentOS Web Panel change hostname http redirect https

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 ▼

Click on the left side of the CWP control panel: WebServer Settings → Select WebServers Sheet 2

Step 2: Choose Nginx & Varnish & Apache ▼

Step 2: CWP Control Panel Select Nginx & Apache Sheet 3

Step 3: Click the “Save & Rebuild Configuration” button at the bottom to save and rebuild the configuration.

Step 4: Check the CWP homepage Dashboard service status▼

How to change the hostname in Linux? The first picture of CentOS Web Panel changing the hostname to http and redirecting to https

  • Make sure they are all in Active state.

Step 5: Every time you reset the default web server, you must optimize the Nginx settings▼

Attention points

 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
 

Comment

Your email address will not be published. Required fields * Callout

Scroll to Top