Capital City Christian ChurchMySQL Examples
We are developing an internal web server that will house the Network Documentation and other internal applications. It will run Apache2 and MySQL using Perl scripts for the CGI interface.
This page covers installation of the Apache2 HTTPd Web Server.
Install
$ sudo apt install apache2
Most configuration files are in /etc/apache2/. Logs are in /var/log/apache2/
The web root is in /var/www/html/
Apache provides a command to check syntax errors in your Apache configuration files in order to avoid errors when you restart the Apache web server. This is shown below:
sudo apache2ctl -t sudo systemctl start apache2 sudo systemctl stop apache2 sudo systemctl restart apache2 sudo systemctl status apache2
To enable the Apache Service to start automatically on system boot, issue the following command below:
sudo systemctl enable apache2
Setting up CGI/Perl
# a2enmod cgid Enabling module cgid. To activate the new configuration, you need to run: systemctl restart apache2 root@ben-b:/etc/apache2# systemctl restart apache2
Ref. https://www.server-world.info/en/note?os=Ubuntu_18.04&p=httpd&f=2
CGI scripts are in /var/www/html/cgi-bin/
# chmod 705 /usr/lib/cgi-bin/test_script.pl # mkdir /var/www/html/cgi/ # cat > /etc/apache2/conf-available/cgi.conf <<'EOF' # create new # processes .cgi and .pl as CGI scripts <Directory "/var/www/html/cgi"> Options +ExecCGI AddHandler cgi-script .cgi .pl </Directory> EOF $ mkdir /var/www/html/cgi $ a2enconf cgi $ systemctl restart apache2 cat > /var/www/html/cgi/index.cgi <<'EOF' #!/usr/bin/perl print "Content-type: text/html\n\n"; print "\n\n"; print "\n"; print "CGI Test Page"; print "\n\n"; print "\n\n"; EOF chmod 705 /var/www/html/cgi/index.cgi
Usage: httpd [-D name] [-d directory] [-f file] [-C "directive"] [-c "directive"] [-k start|restart|graceful|graceful-stop|stop] [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X] Options: -D name : define a name for use in directives -d directory : specify an alternate initial ServerRoot -f file : specify an alternate ServerConfigFile -C "directive" : process directive before reading config files -c "directive" : process directive after reading config files -e level : show startup errors of level (see LogLevel) -E file : log startup errors to file -v : show version number -V : show compile settings -h : list available command line options (this page) -l : list compiled in modules -L : list available configuration directives -t -D DUMP_VHOSTS : show parsed vhost settings -t -D DUMP_RUN_CFG : show parsed run settings -S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG -t -D DUMP_MODULES : show all loaded modules -M : a synonym for -t -D DUMP_MODULES -t : run syntax check for config files -T : start without DocumentRoot(s) check -X : debug mode (only one worker, do not detach)
Setup and use monitoring module https://www.tecmint.com/monitor-apache-web-server-load-and-page-statistics/
Ben, Do this stuff https://www.tecmint.com/apache-security-tips/