Changing Your Server Hostname

From Sympl Wiki
Revision as of 09:34, 20 August 2019 by Kelduum (talk | contribs) (Created page with "A number of functions in Sympl use the servers hostname to determine it's defaults, such as emails sent to unix users, the default fallback site for any unmatched sites, a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A number of functions in Sympl use the servers hostname to determine it's defaults, such as emails sent to unix users, the default fallback site for any unmatched sites, and the default SSL certificates used for things like Email and FTP connections.


new_hostname=replace.this.with-your-new.hostname
new_short_hostname=$( echo $new_hostname | cut -d . -f 1 )
old_hostname=$( hostname )
old_short_hostname=$( hostname -s )

sudo hostname $new_hostname

if [ ! -d /srv/$new_hostname/ ]; then mv /srv/$old_hostname/ /srv/$new_hostname/; fi

sudo sympl-ssl --verbose --force $new_hostname

sudo rm /etc/ssl/ssl.combined /etc/ssl/ssl.crt /etc/ssl/ssl.key
sudo ln -s /srv/$new_hostname/config/ssl/current/ssl.combined /etc/ssl/ssl.combined
sudo ln -s /srv/$new_hostname/config/ssl/current/ssl.crt /etc/ssl/ssl.crt
sudo ln -s /srv/$new_hostname/config/ssl/current/ssl.key /etc/ssl/ssl.key

sudo sympl-web-configure
sudo service apache2 reload

echo $new_hostname | sudo tee /etc/hostname | sudo tee /etc/mailname