Difference between revisions of "Web-server-stack"

From Funtoo
Jump to navigation Jump to search
m
(trim out crufty packages im not going to document)
(One intermediate revision by the same user not shown)
Line 2: Line 2:
== Pre-install considerations ==
== Pre-install considerations ==
=== ssl ===
=== ssl ===
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].  Many web apps require you set your URL & will have problems if your URL is set to http://, rather than https://
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.  https://www.startssl.com offers free ssl ca certificates, though there are several other 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.


=== sockets vs tcp stack ===
=== Unix Sockets vs TCP stack ===
Sockets have less overhead but can not be shared across jails, or to other machines.  Tcp stack has more overhead but is far more flexible.
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|mail-mta/postfix}}  <-- suggested
* {{Package|mail-mta/postfix}}  <-- suggested, installed by default.
* {{Package|mail-mta/ssmtp}}
* {{Package|mail-mta/exim}}
* {{Package|mail-mta/sendmail}}
* {{Package|mail-mta/nullmailer}}


=== FTP Servers ===
=== FTP Servers ===
Line 19: Line 15:
* {{Package|net-ftp/vsftpd}} <-- suggested  
* {{Package|net-ftp/vsftpd}} <-- suggested  
* {{Package|net-ftp/proftpd}}
* {{Package|net-ftp/proftpd}}
* {{Package|net-ftp/pure-ftpd}}
* {{Package|net-ftp/qshare}}


== 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 ===
Line 29: Line 23:


mariadb is a drop in replacement for mysql
mariadb is a drop in replacement for mysql
* {{Package|dev-db/mariadb}} <-- suggested
* {{Package|dev-db/mariadb}} <-- suggested for mysql users


percona is a drop in replacement for mysql
percona is a drop in replacement for mysql
* {{Package|dev-db/percona-server}}
* {{Package|dev-db/percona-server}}


* {{Package|dev-db/postgresql-server}}
* {{Package|dev-db/postgresql-server}} <-- suggested over mysql
* {{Package|dev-db/sqlite}}
* {{Package|dev-db/sqlite}}


Line 44: Line 38:
=== Web Servers ===
=== Web Servers ===
* {{Package|www-servers/apache}}
* {{Package|www-servers/apache}}
* {{Package|www-servers/cherokee}}
* {{Package|www-servers/nginx}}
* {{Package|www-servers/nginx}} <-- suggested
* {{Package|www-servers/tengine}} <-- suggested
* {{Package|www-servers/tengine}}
* {{Package|www-servers/lighttpd}}
* {{Package|www-servers/lighttpd}}


Line 55: Line 48:
* {{Package|net-misc/memcached}} <-- suggested database cache to speed up database queries.
* {{Package|net-misc/memcached}} <-- suggested database cache to speed up database queries.
* {{Package|dev-db/redis}}
* {{Package|dev-db/redis}}
* {{Package|www-servers/nginx}}
* {{Package|www-servers/nginx}}<-- suggested for ssl termination & load balancing
* {{Package|www-servers/tengine}}
* {{Package|www-servers/tengine}}
* {{package|net-misc/stunnel}}
* {{package|www-servers/pound}} <-- suggested for ssl termination & load balancing
* {{Package|www-servers/varnish}} <-- suggested for caching to reduce power consumption & reduce the need of constantly rebuilding pages
* {{Package|www-servers/varnish}} <-- suggested for caching to reduce power consumption & reduce the need of constantly rebuilding pages
* {{Package|net-proxy/squid}}
* {{Package|net-proxy/squid}}
Line 66: Line 57:


=== Firewalls ===
=== Firewalls ===
* {{Package|net-firewall/nftables}}
* {{Package|net-firewall/nftables}} <-- suggested
* {{Package|net-firewall/iptables}} <-- suggested
* {{Package|net-firewall/iptables}}
* {{Package|net-firewall/firewalld}}
* {{Package|net-firewall/firewalld}} note: broken under *too
* {{Package|net-firewall/ufw}}


=== Dynamic Firewalling ===
=== Dynamic Firewalling ===
* {{Package|app-admin/sshguard}} <-- suggested
* {{Package|app-admin/sshguard}} <-- suggested
* {{Package|net-analyzer/fail2ban}}
=== Webapp Firewalls ===


Apache has an option for webapplication firewallingas far as [[User:Threesixes|Threesixes]] ([[User talk:Threesixes|talk]]) can tell this passes login errors & excessive site fuzzing to logs for fail2ban/sshguard to deal with.
=== Webapp Security ===
https://github.com/nbs-system/naxsi is a web app firewall for nginx.
Install mod_security on your web serversSee the [https://www.owasp.org/index.php/Main_Page open web app security project]


=== Benchmarking ===
=== Benchmarking ===
Line 89: Line 76:
* http://getfirebug.com/
* http://getfirebug.com/
* {{Package|app-admin/apache-tools}}
* {{Package|app-admin/apache-tools}}
* {{Package|app-benchmarks/sysbench}}
* {{Package|app-benchmarks/phoronix-test-suite}}
* {{Package|app-benchmarks/iozone}}
* {{Package|app-benchmarks/piozone}}
* {{Package|app-benchmarks/siege}}
* {{Package|app-benchmarks/ramspeed}}
* {{Package|app-benchmarks/jmeter}}

Revision as of 20:00, May 11, 2015

Pre-install considerations

ssl

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. https://www.startssl.com offers free ssl ca certificates, though there are several other 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.

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.