arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Hosting Server Related

hashtag
CHANGE TIME ZONE

  1. Edit php.ini file (/Applications/XAMPP/xamppfiles/etc/php.ini if you use XAMPP in MacOS)

Change:

to:

2. Restart server

hashtag
SETTING UP HTTPS (SECURED HTTP) FOR OE (RECOMMENDED)

This is optional but recommend for any site that requires user login

This specifically apply to:

  • CentOS 7

  1. Follow the instruction in this website to install and enable ssl:

triangle-exclamation

Ignore Step 3 in the tutorial above

2. Create /etc/httpd/conf.d/oe.conf (same name as the folder contain Open Enventory, in this case /var/www/html/oe)

In Terminal, type:

Add the content below:

circle-info

All of these below info (highlighted in red can be change to match specific ip address as well as document location:

  • ServerName your_url.net

  • DocumentRoot /var/www/html/oe

2. Restart apache service, in Terminal:

hashtag
SETTING UP CRONTAB TO AUTOMATICALLY BACKUP YOUR DATABASE

This is optional but recommend for auto back up the OE database as well as the user’s info and password

This specifically apply to: CentOS 7 (Apache version: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/5.5.25 PHP version: 5.5.25 MySQL server version: 5.5.41-MariaDB)

  1. Set up sshpass to automatically pass the password. Note: this is not ultrasafe but it is simple. Check out this link: (only need to follow how to install, step 1)

  2. Go into Terminal in your server and log in as root user (type: “su” and then password at the command line

Note: you can do the rest of the command lines below with prefix “sudo your-command-here” if you don’t want to log in as root

3. At the command line, type:

4. When the file is open, insert the following. Note: everything is red can be changed to match specific details. -$(date +\%Y\%m\%d): is used to set automatic date

5. More example of crontab can be read here:

hashtag
OPTIMIZING CENTOS 7 PERFORMANCE

hashtag
IP BLOCKING FOR SECURITY ENHANCEMENT ON CENTOS 7 SERVER

This guide to use access_log to find out some high frequent access ip and then check them manually and form a block ip if necessary

hashtag
Find IP address with the most access

  1. Follow this: , first answer

  2. Specifically, ssh into the server and then log in as root user

  3. Use following command:

change “-20” to “-xx” with “xx” is the number of result. This is sort from most to least access request

4. Google any ip lookup website and check these IPs(e.g: ). If find any suspicious ones, you can add a rule to block those ip network address by the next step

hashtag

hashtag
Setting up rule to block ip network.

Follow this guide:

hashtag

hashtag
Finding info about the network list

  1. Follow this guide:

  2. Specifically using this command (after ssh into the server and then log in as root)

To list the IP sets known to firewalld in the permanent environment, use the following command as root:

3. To get more information about the IP set, use the following command as root: (in the example below, “test” is the name of ipsets you got from the above command

Or:

To see the extended entries list of the IP set, use the following command as root:

hashtag

hashtag
To block IP from a whole country

  1. Follow this guide:

hashtag
FREEING DISK SPACE IN CENTOS 7

See these references:

hashtag
ADVANCE FILE AND FOLDER PERMISSION/OWNERSHIP SETTING IN CENTOS 7

See the following resources:

  • Good and comprehensive:

  • Simple preservation of parent folder group owernship for all files newly created:

date.timezone=Europe/Berlin
  • Redirect permanent / https://romo.ddns.net/

  • http://wiki.centos.org/HowTos/Https#head-35299da4f7078eeba5f5f62b0222acc8c5f2db5farrow-up-right
    http://www.server-world.info/en/note?os=CentOS_7&p=ssh&f=7arrow-up-right
    https://stackoverflow.com/questions/18682308/sort-uniq-ip-address-in-from-apache-logarrow-up-right
    https://whatismyipaddress.com/ip-lookuparrow-up-right
    https://www.getpagespeed.com/server-setup/security/centos-7-ban-bad-ips-and-networks-with-firewalldarrow-up-right
    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-setting_and_controlling_ip_sets_using_firewalldarrow-up-right
    http://www.vanemery.com/Linux/ACL/linux-acl.html#defaultarrow-up-right
    https://serverfault.com/a/361666arrow-up-right
    https://unix.stackexchange.com/questions/115631/getting-new-files-to-inherit-group-permissions-on-linuxarrow-up-right
    date.timezone=America/Chicago
    sudo vi /etc/httpd/conf.d/oe.conf
    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerName your_url.net
        DocumentRoot /var/www/html/oe
        Redirect permanent / https://your_url.net
    </VirtualHost>
    
    NameVirtualHost *:443
    <VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/ca.crt
        SSLCertificateKeyFile /etc/pki/tls/private/ca.key
        <Directory /var/www/html/oe>
            AllowOverride All
        </Directory>
        DocumentRoot /var/www/html/oe
        ServerName your_url.net
    </VirtualHost>
    sudo systemctl restart httpd.service
    crontab –e
    #This is to back up the Romo's OE database into home/khoi/OEbackup, every day at 00:05 am
    5 0 * * * mysqldump -u root –pyour-password romo > /home/khoi/OEbackup/romo-backup-`date +"%Y%m%d"`.sql
    
    #This is to back up the user table in mysql in order to save users' password, every day at 00:10 am
    10 0 * * * mysqldump -u root -pyour-password mysql user > /home/khoi/OEbackup/romo-backup-user`date +"%Y%m%d"`.sql
    
    #This is to copy the back up file to External harddrive, every day at 00:15 am
    15 0 * * * sshpass -p your-password rsync -ave ssh --ignore-existing /home/khoi/OEbackup/ daniel@romomacpro.ddns.net:/Users/daniel/Documents/OEbackup/
    
    #This is to delete the file every month
    0 0 * * */4 rm -r /home/khoi/OEbackup/romo-backup-*.sql
    cat /var/log/httpd/access_log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20
    firewall-cmd --permanent --get-ipsets
    firewall-cmd --permanent --info-ipset=test
    firewall-cmd --permanent --ipset=test --get-entries
    https://askubuntu.com/questions/642236/how-to-make-the-newly-created-files-inherit-the-directorys-permissionsarrow-up-right
    [TOP TIP] firewalld and ipset (country blacklist) | Linode QuestionsLinode Cloud Hostingchevron-right
    Linux Crontab: 15 Awesome Cron Job ExamplesThe Geek Stuffchevron-right
    Logo
    Apache2 and php fpm performance optimization — Step-by-step guideMediumchevron-right
    How do I clear space on my main system drive on a Linux CentOS system?Stack Overflowchevron-right
    Freeing disk space on your Linux servermaryrosecook.comchevron-right
    Logo
    Logo
    https://blog.vpscheap.net/how-to-optimize-apache-performance-on-centos-7/blog.vpscheap.netchevron-right
    Understanding Crontab in Linux with 20 Useful ExamplesTecAdminchevron-right
    Logo
    Logo
    How to free up space on centos serverStack Overflowchevron-right
    Logo
    Logo