- Instant Debian:Build a Web Server
- Jose Miguel Parrella
- 497字
- 2021-08-04 10:11:38
Getting ready
Before you start to install Debian, you will need to decide how you want to partition your disks. There are several reasons why one would like to partition disks beyond the canonical one-partition approach, most likely for security or specialized storage reasons. Also, if you will be using SAN/NAS dedicated hardware, the setup can be either simplified or made more complex.
Debian, like several POSIX-compliant operating systems and some other Linux distributions, follows the FHS or Filesystem Hierarchy Standard and you can expect configuration files in /etc
, system files in /usr
and /lib
, variable files in /var
, and so on.
There might be some discrepancies, though. FHS calls for /srv
for server roles, but most installations sit variable files in /var
. Static files, application files, and even database files all sit there. Thus, you might want to put /var
on a different partition if you have advanced partitioning or permission needs. You could even partition out /var/lib/mysql
for the MySQL database files, /var/www
for the static and application files (the WWW/Document Root
folder), and so on, like we will do as an example in this book using Logical Volumes (LVM).
Logical volumes will enable you to create more flexible data containers on top of concepts you already know: disks and partitions. Those flexible data containers created by logical volumes can expand different partitions in different disks and are easier to manage, resize, and move. But it can also add management overhead, and will require a more complex set up for clustering.
By granular we mean the ability of setting different behaviors on different partitions depending on the use case. For example, a system administrator can partition out /var/mail
to set ACLs/quotas and so on, DevOps might want to partition out /var
to set security flags such as noexec
(no executable files, which is OK in your web application since processes outside /var
actually run your application), nodev
(no special device files), and nosuid
(no auto-escalation files) or remove filesystem attributes that impact performance (such as time), among others.
Here's a list of flags and their impact on partitioning:

Other directories that you might want to partition out are /tmp
, which will inevitably store temporary files generated by your framework, your application server and other services, making the noexec/nodev/nosuid
combo is very popular in this case to prevent the execution of potentially malicious files, along with dedicated disk space monitoring to prevent the partition from filling out, which can stop the server altogether.
In other scenarios (such as the mail server we talked about earlier), people will find great value in partitioning out /home
, as they will be able to set ACLs and quotas and manage space much easier. But in a web application server scenario, while you are free to continue partitioning (Debian will partition out the swap space and /boot
for you), the benefit you can get from continuing to do so (/usr
, /etc
, and so on) is arguable and can add unnecessary complexity.
- C語言程序設計實踐教程(第2版)
- .NET之美:.NET關鍵技術深入解析
- GitLab Cookbook
- 兩周自制腳本語言
- Python程序設計(第3版)
- Xamarin.Forms Projects
- 用Python實現深度學習框架
- 移動互聯網軟件開發實驗指導
- Mastering Python Design Patterns
- Regression Analysis with Python
- Django 3.0入門與實踐
- Python Machine Learning Blueprints:Intuitive data projects you can relate to
- Django Design Patterns and Best Practices
- Spring Boot從入門到實戰
- 編程的原則:改善代碼質量的101個方法