Difference between revisions of "Web-server-stack"

From Funtoo
Jump to navigation Jump to search
m (worded less spammy as discussed about)
(StartCom no longer offers free ssl CA certificates. Added explanation of CA authority. dev-db/postgresql-server doesn't exist, changed to dev-db/postgresql.)
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:


== Pre-install considerations ==
== Pre-install considerations ==
Ssl [http://en.wikipedia.org/wiki/Wildcard_certificate wild card certificates] can use the same certificate to cover several subdomain names.  As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate.  https://funtoo.org would not be covered under the wildcard, so [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) suggests using http://domain.tld as a http navigation splash page directory.  All that is required to setup a ca signed ssl certificate is an email on the server.  https://www.startssl.com offers free ssl ca certificates, though there are several other certificate [http://en.wikipedia.org/wiki/Certificate_authority#Providers providers].  Some web applications have http hard coded into the css style sheets urls instead of using relative urls, so they need to be changed to https or relative if you lose your styles.
=== ssl ===
A CA signed certificate is a certificate that has been issued and signed by a publicly trusted certificate authority (CA).
 
Ssl [http://en.wikipedia.org/wiki/Wildcard_certificate wild card certificates] can use the same certificate to cover several subdomain names.  As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate.  https://funtoo.org would not be covered under the wildcard.  All that is required to setup a CA signed ssl certificate is an email on the server.  Free ssl CA certificates are available through several certificate [http://en.wikipedia.org/wiki/Certificate_authority#Providers providers].  Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https:// when using ssl/tls.
 
[https://www.startssl.com StartCom CA] no longer offers free ssl ca certificates as it is closed as of Jan. 1st, 2018, it doesn't issue any new certificate from StartCom name roots.
 
=== Unix Sockets vs TCP stack ===
Sockets have less overhead but can not be shared across jails, or to other machines.  The TCP stack has more overhead but is far more flexible.


=== Email Servers ===
=== Email Servers ===
*[[Package:Ssmtp|Ssmtp]]
* {{Package|mail-mta/postfix}}  <-- suggested, installed by default.
*[[Package:Postfix|Postfix]]
 
*[[Package:Exim|Exim]]
=== FTP Servers ===
*[[Package:Sendmail|Sendmail]]
It is common practice to use FTP servers to host files for downloading.
 
* {{Package|net-ftp/vsftpd}} <-- suggested
* {{Package|net-ftp/proftpd}}


== Webserver ==
== Webserver ==
Web servers come in several varieties.  The most common stack is known as LAMP which stands for linux apache mysql php.  [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.
Web servers come in several varieties.  The most common stack is known as LAMP which stands for linux apache mysql php.  Funtoo suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.


=== Databases ===
=== Databases ===
*[[Package:MySQL|MySQL]]
* {{Package|dev-db/mysql}}
*[[Package:Mariadb|Mariadb]]
 
*[[Package:Postgresql|Postgresql]]
mariadb is a drop in replacement for mysql
*[[Package:Sqlite|sqlite]]
* {{Package|dev-db/mariadb}} <-- suggested for mysql users
 
percona is a drop in replacement for mysql
* {{Package|dev-db/percona-server}}
 
* {{Package|dev-db/postgresql}} <-- suggested over mysql
* {{Package|dev-db/sqlite}}


=== Languages ===
=== Languages ===
*[[Package:Php|PHP]]
* {{Package|dev-lang/php}} <-- suggested
*[[Package:Perl|Perl]]
* {{Package|dev-lang/perl}}
*[[Package:Python|Python]]
* {{Package|dev-lang/python}}


=== Web Servers ===
=== Web Servers ===
*[[Package:Apache|Apache]]
* {{Package|www-servers/apache}}
*[[Package:Nginx|nginx]]
* {{Package|www-servers/nginx}}
*[[Package:Lighttpd|Lighttpd]]
* {{Package|www-servers/tengine}} <-- suggested
* {{Package|www-servers/lighttpd}}
 
 
=== SSL Termination, Reverse Proxies, Caching, & load balancing ===
Reverse proxies are useful, some cache static data, and shuck out cached pages rather than hitting the web server.  Some pass requests to backend nodes high availability clustering your website, some web servers have this functionality built in.
 
* {{Package|net-misc/memcached}} <-- suggested database cache to speed up database queries.
* {{Package|dev-db/redis}}
* {{Package|www-servers/nginx}}<-- suggested for ssl termination & load balancing
* {{Package|www-servers/tengine}}
* {{Package|www-servers/varnish}} <-- suggested for caching to reduce power consumption & reduce the need of constantly rebuilding pages
* {{Package|net-proxy/squid}}


== Post install ==
== Post install ==
Line 32: Line 61:


=== Firewalls ===
=== Firewalls ===
*[[Package:Nftables|Nftables]]
* {{Package|net-firewall/nftables}} <-- suggested
*[[Package:Iptables|Iptables]]
* {{Package|net-firewall/iptables}}
*[[Package:Firewalld|Firewalld]]
* {{Package|net-firewall/firewalld}} note: broken under *too
*[[Package:Ufw|Ufw]]


=== Dynamic Firewalling ===
=== Dynamic Firewalling ===
*[[Package:Sshguard|Sshguard]]
* {{Package|app-admin/sshguard}} <-- suggested
*[[Package:Fail2ban|Fail2ban]]
 
=== Webapp Security ===
Install mod_security on your web servers.  See the [https://www.owasp.org/index.php/Main_Page open web app security project]
 
=== Benchmarking ===
It's a good idea to benchmark your system, server, & websites.  There are several tools to assist you in doing this.
 
* http://toolbar.netcraft.com/site_report?url=undefined#last_reboot
* http://gtmetrix.com/
* http://www.showslow.com/
* http://yslow.org/
* http://getfirebug.com/
* {{Package|app-admin/apache-tools}}

Latest revision as of 06:11, July 2, 2021

Pre-install considerations

ssl

A CA signed certificate is a certificate that has been issued and signed by a publicly trusted certificate authority (CA).

Ssl wild card certificates can use the same certificate to cover several subdomain names. As in https://wiki.funtoo.org https://www.funtoo.org https://forums.funtoo.org can all use the same certificate. https://funtoo.org would not be covered under the wildcard. All that is required to setup a CA signed ssl certificate is an email on the server. Free ssl CA certificates are available through several certificate providers. Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https:// when using ssl/tls.

StartCom CA no longer offers free ssl ca certificates as it is closed as of Jan. 1st, 2018, it doesn't issue any new certificate from StartCom name roots.

Unix Sockets vs TCP stack

Sockets have less overhead but can not be shared across jails, or to other machines. The TCP stack has more overhead but is far more flexible.

Email Servers

FTP Servers

It is common practice to use FTP servers to host files for downloading.

Webserver

Web servers come in several varieties. The most common stack is known as LAMP which stands for linux apache mysql php. Funtoo suggests setting up the web server stack by selecting the database first, then scripting language second, and web server 3rd.

Databases

mariadb is a drop in replacement for mysql

percona is a drop in replacement for mysql

  • No results

Languages

Web Servers


SSL Termination, Reverse Proxies, Caching, & load balancing

Reverse proxies are useful, some cache static data, and shuck out cached pages rather than hitting the web server. Some pass requests to backend nodes high availability clustering your website, some web servers have this functionality built in.

Post install

There are several considerations to take into account with a web server install, such as setting up an email server, setting up a firewall, firewalling web applications, and dynamically firewalling attackers.

Firewalls

Dynamic Firewalling

Webapp Security

Install mod_security on your web servers. See the open web app security project

Benchmarking

It's a good idea to benchmark your system, server, & websites. There are several tools to assist you in doing this.