Moving HTTPD From One Machine to Another: Difference between revisions

From DISI
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 5: Line 5:
# Install these packages
# Install these packages
#: <source> dnf install -y webalizer httpd certbot python3-certbot-apache mod_limitipconn </source>
#: <source> dnf install -y webalizer httpd certbot python3-certbot-apache mod_limitipconn </source>
# Enable http and https ports
#: <source>
firewall-cmd --permanent --add-service={http,https}
</source>
# Copy these files from old to new machine
# Copy these files from old to new machine
#* /etc/httpd/conf.d/*
#* /etc/httpd/conf.d/*
Line 15: Line 19:
#* /var/www/usage/
#* /var/www/usage/
# Turn off TraceEnable in httpd.conf in new machine
# Turn off TraceEnable in httpd.conf in new machine
#* <source>
#: <source>
echo "TraceEnable off" >> /etc/httpd/conf/httpd.conf
echo "TraceEnable off" >> /etc/httpd/conf/httpd.conf
  </source>
  </source>
# Add httpd logs to logrotate configuration file
#* vim /etc/logrotate.d/httpd
#* Delete everything inside and replace with:
#:<source>
/var/log/httpd/*log {
        monthly
        rotate 3
        size=10M
        compress
        missingok
        notifempty
dateext
dateformat -%m%d%Y
sharedscripts
postrotate
        /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
endscript
}
/var/log/httpd/*/*log {
monthly
rotate 3
size=10M
compress
missingok
notifempty
dateext
        dateformat -%m%d%Y
sharedscripts
postrotate
/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    endscript
}
</source>
# Add these jobs to cron
#: <source>
0 0 * * * /bin/certbot renew
0 6 * * SAT /etc/webalizer.d/cronwebalizer.csh
</source>
# Change selinux from enforce to permissive
#* setenforce 0
#* vim /etc/selinux/config
#: <source>
SELINUX=permissive
</source>
#* Check with "sestatus". Make sure these two below are permissive
#: <source>
Current mode:                  permissive
Mode from config file:          permissive
</source>

Revision as of 00:35, 17 July 2024

Introduction

Here are instructions on how to migrate HTTPD functions to another machine. Main example is migrating from CentOS 7 to Rocky Linux 8 (vav to vav2)

Instructions

  1. Install these packages
     dnf install -y webalizer httpd certbot python3-certbot-apache mod_limitipconn
  2. Enable http and https ports
    firewall-cmd --permanent --add-service={http,https}
  3. Copy these files from old to new machine
    • /etc/httpd/conf.d/*
    • /var/www/html/index.html
    • /etc/webalizer.d/*
    • /etc/letsencrypt
    • /root/UCSF_SSL_CERT
    • /var/log/httpd/*
    • /var/lib/webalizer/
    • /var/www/usage/
  4. Turn off TraceEnable in httpd.conf in new machine
    echo "TraceEnable off" >> /etc/httpd/conf/httpd.conf
  5. Add httpd logs to logrotate configuration file
    • vim /etc/logrotate.d/httpd
    • Delete everything inside and replace with:
    /var/log/httpd/*log {
            monthly
            rotate 3
            size=10M
            compress
            missingok
            notifempty
    	dateext
    	dateformat -%m%d%Y
    	sharedscripts
    	postrotate
            	/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    	endscript
    }
    
    /var/log/httpd/*/*log {
    	monthly
    	rotate 3
    	size=10M
    	compress
    	missingok
    	notifempty
    	dateext
            dateformat -%m%d%Y
    	sharedscripts
    	postrotate
    		/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
        	endscript
    }
  6. Add these jobs to cron
    0 0 * * * /bin/certbot renew
    0 6 * * SAT /etc/webalizer.d/cronwebalizer.csh
  7. Change selinux from enforce to permissive
    • setenforce 0
    • vim /etc/selinux/config
    SELINUX=permissive
    • Check with "sestatus". Make sure these two below are permissive
    Current mode:                   permissive
    Mode from config file:          permissive