LogoLogo
Modified Version by KVOriginal Source CodeContact
KV.2019-12-01
KV.2019-12-01
  • Overviews
  • Contact
  • User Guides
    • Chemical Inventory
      • Database
        • Database Backup and Restore
        • Best Practice for SQL Users Backup
      • Chemicals
        • Search Chemicals
        • Add a single chemical
        • Import a list of chemicals
        • Edit Chemicals
        • Borrow and Return Chemicals
        • Delete a chemical container
        • Delete multiple chemical containers
      • Users
      • Storages/Locations
      • Terminal Mode
        • Set Up a Terminal User
        • Borrow and Return Chemicals
        • Change Chemical Location
        • Get Information on a Chemical
        • Dispose of Chemicals
      • TODO
    • Electronic Lab Notebook
  • Installation
    • Raspbian on Raspberry pi 3B
    • CentOS 7
    • Mac OSX
    • Windows
  • Advanced Settings
    • OE Settings
    • Hosting Server Related
    • Resources for Setting Up New Server
    • Other Supporting Programs for OE
      • Find Missing SDS
      • Find Missing Structure
    • Docker Build
  • Change Logs
    • Versions
Powered by GitBook
On this page
  • CHANGE TIME ZONE
  • SETTING UP HTTPS (SECURED HTTP) FOR OE (RECOMMENDED)
  • SETTING UP CRONTAB TO AUTOMATICALLY BACKUP YOUR DATABASE
  • OPTIMIZING CENTOS 7 PERFORMANCE
  • IP BLOCKING FOR SECURITY ENHANCEMENT ON CENTOS 7 SERVER
  • Find IP address with the most access
  • Setting up rule to block ip network.
  • Finding info about the network list
  • To block IP from a whole country
  • FREEING DISK SPACE IN CENTOS 7
  • ADVANCE FILE AND FOLDER PERMISSION/OWNERSHIP SETTING IN CENTOS 7

Was this helpful?

Export as PDF
  1. Advanced Settings

Hosting Server Related

PreviousOE SettingsNextResources for Setting Up New Server

Last updated 5 years ago

Was this helpful?

CHANGE TIME ZONE

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

Change:

date.timezone=Europe/Berlin

to:

date.timezone=America/Chicago

2. Restart server

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:

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:

sudo vi /etc/httpd/conf.d/oe.conf

Add the content below:

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>

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

  • Redirect permanent / https://romo.ddns.net/

2. Restart apache service, in Terminal:

sudo systemctl restart httpd.service

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. 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:

crontab –e

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

#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

5. More example of crontab can be read here:

OPTIMIZING CENTOS 7 PERFORMANCE

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

Find IP address with the most access

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

  2. Use following command:

cat /var/log/httpd/access_log | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20

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

Setting up rule to block ip network.

Finding info about the network list

  1. 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:

firewall-cmd --permanent --get-ipsets

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

firewall-cmd --permanent --info-ipset=test

Or:

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

firewall-cmd --permanent --ipset=test --get-entries

To block IP from a whole country

  1. Follow this guide:

FREEING DISK SPACE IN CENTOS 7

See these references:

ADVANCE FILE AND FOLDER PERMISSION/OWNERSHIP SETTING IN CENTOS 7

See the following resources:

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)

Follow this: , first answer

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

Follow this guide:

Follow this guide:

Good and comprehensive:

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

http://wiki.centos.org/HowTos/Https#head-35299da4f7078eeba5f5f62b0222acc8c5f2db5f
http://www.server-world.info/en/note?os=CentOS_7&p=ssh&f=7
https://stackoverflow.com/questions/18682308/sort-uniq-ip-address-in-from-apache-log
https://whatismyipaddress.com/ip-lookup
https://www.getpagespeed.com/server-setup/security/centos-7-ban-bad-ips-and-networks-with-firewalld
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-setting_and_controlling_ip_sets_using_firewalld
http://www.vanemery.com/Linux/ACL/linux-acl.html#default
https://serverfault.com/a/361666
https://unix.stackexchange.com/questions/115631/getting-new-files-to-inherit-group-permissions-on-linux
https://askubuntu.com/questions/642236/how-to-make-the-newly-created-files-inherit-the-directorys-permissions
LogoLinux Crontab: 15 Awesome Cron Job ExamplesThe Geek Stuff
LogoCrontab in Linux with 20 Useful Examples to Schedule JobsTecAdmin
LogoApache2 and php fpm performance optimization — Step-by-step guideMedium
LogoHow to optimize Apache performance on CentOS 7VPSCheap.NET Blog
Logo[TOP TIP] firewalld and ipset (country blacklist) | Linode QuestionsLinode Cloud Hosting
LogoFreeing disk space on your Linux server
LogoHow do I clear space on my main system drive on a Linux CentOS system?Stack Overflow
LogoHow to free up space on centos serverStack Overflow