We all know something about computer literacy and the most popular IT solutions in Poland. Windows dominates. At school, teachers introduce parts of Office, Paint, sometimes programming, and safe internet use, or at least they should. At lower educational levels, programming has only recently appeared in a playful form; secondary school offers more. After school, computers are used for entertainment and eventually work, but Microsoft's system still leads. That is understandable: it is simple, graphical, and familiar. The same applies to students and young IT employees, since relatively few work regularly with another operating system. An ambitious person or free-software enthusiast may install Linux. Some with more money choose macOS, sometimes for the Apple brand rather than technical capabilities. Windows nevertheless remains the most common choice among inexperienced programmers, and experienced ones too.
This is entirely understandable but has consequences. Since most servers run Linux, for good reason, and many development tools originate there, anyone unfamiliar with the Penguin will sooner or later need to catch up. Besides self-study, computer science degrees and even vocational schools provide relevant classes. I occasionally learn, however, that not every institution covers the subject equally thoroughly. If the curriculum neglects it, the teacher makes little effort, and the student feels no need to learn independently, that student may know very little about Linux and fear it even more. Reality then catches up. This article responds to that situation.
Who is this guide for, and what does it cover?
Let's start with the second question: this is not a complete guide to administering Linux and its applications. I am a programmer rather than an administrator, and mainly work on Windows. My work nevertheless frequently includes deploying what I have written to various servers and environments, mostly Linux-based. I know that not everyone acquires these skills in class or through experiments at home. At work or in university group projects, some rely on teammates. This article therefore covers the basics of deploying and running applications on ready-made Linux hosting. Virtual servers with preinstalled services for hosting websites are very popular. Today, we will focus on finding your way around a managed VPS. The knowledge should also help people with ordinary hosting, meaning only a control panel and FTP, without a terminal, because I will explain how things work in simple terms. I will often use MyDevil.net as an example, but this is not an advertisement.
This text is therefore for:
- junior developers a little afraid of deployment or working on a server, even without superuser privileges,
- computer science students who may have studied Linux but have not used it on a production server,
- programming enthusiasts taking their first steps in running something on a server,
- experienced developers and administrators who enjoy pointing out mistakes in guides.
I will not cover basic Linux commands such as ls for listing files and directories, cd for changing directories, cp for copying, or mv for moving and renaming. You can look up the necessary commands, write a cheat sheet, or consult existing beginner guides. Here, we will focus more on deploying applications and handling situations such as a boss asking why a website is down. I will deliberately simplify some issues so everyone can understand them and explore further afterward.
One more thing before we begin: developers who think they can avoid Linux servers are unfortunately mistaken. Maintaining the machine is an administrator's responsibility. That person has the greatest knowledge, can suggest suitable solutions, and configure the environment properly. But administrators do not deploy the application. In smaller companies, neither does a deployment specialist or DevOps engineer: the programmer does. The developer is also usually alerted when a client reports a problem and someone needs to check logs or establish whether the fault lies in the software, its use, or something requiring an administrator. Aspiring programmers should therefore not ignore server topics. You need not become specialists, but should know the basics. Sooner or later, they will help or save time.
What does a typical server setup look like?
As mentioned, we will mainly discuss servers with components already prepared. Configuration options are limited, but we can log in, upload an application, inspect diagnostics, access databases, and so on. From a broad perspective, the arrangement is similar on servers configured entirely by us, such as root-access VPSs or dedicated servers.
Servers usually provide a separate part of the filesystem with designated storage space. On a typical Ubuntu Server, this is /var/www or /var/www/html, but on a hosted virtual server we can usually forget those locations. We normally access our home directory at /home/[nazwa usera] and look beneath it. A directory such as /srv or /storage is another possibility. Consult the service's documentation if available. On MyDevil.net servers, for example, website files are under /home/[nazwa usera]/domains/[nazwa wirtualnego hosta]. The bracketed Polish placeholders mean the username and virtual host name.
We will discuss virtual hosts later. For now, a visitor needs a particular domain address pointing to our server. The server uses that address to identify which directory to use and where to fetch files. An HTTP server, an application or service, receives requests and routes them, or reports that the requested page cannot be found. For each website, it can expose resources on port 80 for unencrypted HTTP or 443 for HTTPS, provided we supply an SSL certificate. Visitors need not type the port explicitly. Depending on requirements and available options, websites or server applications can use other ports too. We ourselves access the server through port 22, the standard for SSH and SCP, discussed shortly, or 21 for ordinary FTP, which is not recommended but is sometimes the only option.
A database management service is also available, usually MySQL. MyDevil also offers PostgreSQL and MongoDB, for example. Developers can generally create databases and associated users, then work with those databases through the terminal or another provided interface such as phpMyAdmin.
One basic Linux feature deserves explanation: a slash (/) at the start of a path means we begin at the filesystem's root. Windows uses C:\, D:\, or another drive designation; Linux uses /. This can be important when finding your way through server directories. Hidden Linux files also begin with a dot. Show them by adding -a to ls, as in ls -la.
How do you access the server?
Unfortunately, not every server offers a terminal. This particularly affects cheaper hosting or services tightly controlled by administrators for a client. You will then probably have FTP, or File Transfer Protocol, for transferring files. Many programs can connect. I recommend WinSCP, which supports FTP and other protocols that will soon be useful.
Suppose we are fortunate enough to have terminal access. We can connect using the popular SSH protocol, or Secure Shell. This provides a text-based console interface, and many programs support it. You probably know the small, popular PuTTY, a good choice, but consider tools with more features too, such as MobaXterm. Git Bash, installed with Git on Windows, also provides SSH, and an appropriate package can be installed in Windows itself.
How does it work? We need the following:
- the host address, meaning the server, as a domain name or IP address,
- the port number, normally 22 for SSH, though sometimes different for security reasons,
- the username to log in as,
- the user's password, SSH key, or certificate.
In the simplest case, enter this in the terminal:
ssh nazwausera@adresserwera
Then follow the prompts. You will probably first confirm that you want to continue connecting, then enter a password or authenticate with an SSH key. In most terminals, right-clicking pastes the clipboard. For security reasons, some servers prefer authentication exclusively with a private key. This is usually stored on your computer in the .ssh directory beneath your home directory, containing id_rsa and id_rsa.pub. If your private key matches the public key stored on the server, you are logged in. A private key or certificate file can also be specified explicitly with -i:
ssh -i plikzcertyfikatem nazwausera@adresserwera
Terminal access may additionally require connecting through a particular VPN gateway, an extra safeguard sometimes used by administrators. To specify a port other than 22, add -p [numer portu], where the bracketed placeholder means the port number.
You might wonder why you need a silly console when hosting providers offer attractive graphical control panels. Many provide cPanel, Plesk, or their own interfaces for managing servers, databases, virtual hosts, and more. Still, getting comfortable with the terminal is worthwhile. First, it helps you understand where system components are and what they do. Second, some operations are easier there, such as copying or deleting huge numbers of files. Third, terminal skills work on any Linux system, rather than only servers with a particular control panel. Fourth, some servers offer no graphical interface at all, only the console.
The screenshot below shows a successful password-based SSH connection to MyDevil. It also demonstrates pwd, which prints the absolute path of the current directory.
Someone may argue that FTP is better because it offers graphical file management. That is an advantage, but SSH has a similar mechanism: SCP, or Secure File Copy, which works similarly but more securely. Consider WinSCP or Total Commander, which support several protocols. Our experience at Wilda Software favors the former. SCP also works in the terminal, copying files from your computer to a server or back. Knowing these commands can be very helpful.
# skopiowanie pliku file.txt na serwer scp file.txt user@server:/path/for/copied/file #skopiowanie pliku file.txt z serwera na swój komputer do bieżącego katalogu (oznaczanego poprzez kropkę) scp user@server:/path/for/file/file.txt . #skopiowanie zawartości folderu wraz z podfolderami scp -r files/* user@serwer:/path/for/directory/
Here, we can also see that Linux uses a dot (.) for the current directory and an asterisk (*) as the simplest regular expression describing a directory's entire contents. Also remember two dots (..) for the parent directory and the tilde (~) for the user's home directory.
What are ports?
We have mentioned ports without explaining them. Imagine a server as a medieval walled city: ports are its gates. They are entrances or exits for particular services. Some are standard, such as 80 or 22. Others, especially higher-numbered ones, can be used by custom programs or be ephemeral, meaning temporary and used for particular operations.
A simple rule is that fewer externally exposed ports mean a safer server. The more gates we provide, the easier it becomes for an attacker to find an unauthorized route into the filesystem. Administrators are therefore reluctant to allow arbitrary ports to be exposed. It is sometimes possible, especially after developers discuss the need with the server administrator, usually for a service not exposed through the HTTP server. Opening a port and exposing it externally are also different things.
The ports developers most commonly encounter are:
- 21: FTP
- 22: SSH
- 25: SMTP, for sending email, though ports 465 and 587 are usually used
- 80: HTTP
- 143: IMAP, an email retrieval protocol; the other is the increasingly uncommon POP3
- 443: HTTPS
- 3306: MySQL
- 5432: PostgreSQL
A standard service can be assigned another port, as commonly happens with SMTP. This is always up to someone with higher server privileges. It can obscure standard ports to confuse attackers or allow multiple instances of one service, such as two database servers. This is mainly a point of interest, since developers rarely need to do it on most servers.
What is an HTTP server?
We have already mentioned the HTTP server. To recap, it is an application running as a background service, handling HTTP requests and knowing which web application should receive them. Technically, this component opens ports 80 and 443. Developers generally do not configure it themselves. An administrator has the expertise and privileges. Developers can usually create virtual hosts recognized by the HTTP server and adjust certain safe settings, for example through .htaccess files. PHP is similar: the administrator prepares its configuration while leaving developers some freedom.
Most hosting services use one of the two leading HTTP servers:
- Apache2: somewhat simpler in structure, generally considered easier, with behavior adjustable from application-level
.htaccessfiles. - NGINX: somewhat harder to manage, but considered more efficient.
These are not the only options. Microsoft's IIS also exists, and an HTTP server can run directly with an application, since opening a website port can be done programmatically. On servers, however, this is not usual outside special cases.
Knowing which HTTP server is installed matters because it determines how closely developers must work with an administrator to establish the correct configuration. Ready-made hosting commonly uses Apache2 because developers can prepare .htaccess files themselves. Interestingly, MyDevil provides NGINX with support for reading these otherwise foreign configuration files.
What if we are unsure which HTTP server is running? If any page or file can be displayed from it, check the browser's developer tools for the response header named "Server." Below, we can see that wildasoftware.pl uses NGINX.
Checking the PHP configuration is easy too. Create a .php file with the following content and open it in a browser:
<?php phpinfo(); ?>
How do you access the database?
Database access depends heavily on the server. Usually, it is available through the terminal, a graphical interface such as phpMyAdmin, or, less commonly, external access allowing a favorite program on your computer to connect directly. For MySQL, a terminal connection normally looks like this:
mysql -u user -p databasename
When connecting from another computer, add -h dbaddress. The default is localhost.
Common database operations include creating a backup and restoring it from an SQL file. MySQL provides these commands:
mysqldump -u user -p databasename > backupfile.sql mysql -u user -p databasename < backupfile.sql
PostgreSQL works similarly, although its backup procedure differs.
psql -U user -d databasename pg_dump -E UTF-8 -f backupfile.sql -U user -d databasename psql -U user -d databasename < backupfile.sql
How is an application deployed?
The answer depends on the project. Technology, server capabilities, and developers' habits influence the method. Examples include:
- uploading project files manually, which is not recommended but sometimes necessary,
- uploading a ZIP archive and extracting it with a script,
- pushing changes to a designated branch and server using Git.
Many servers with terminal access support the second method. Package the built application into one archive, upload it through SCP, which is faster than copying many small files, and use a prepared Bash script to extract and arrange files in the target location. We cannot offer a universal deployment procedure here, but beginners should know a few things.
First, deploy the built version of the application. This may mean actual generated output, as with Angular or a Java .war file, or simply a directory stripped of development-only or machine-specific files, such as a PHP application without cache files. Repeatedly preparing files manually is tiresome and invites omissions, so a script that does it for us is worthwhile.
Second, most frameworks support environments, meaning separate configurations for different deployment environments. These parameterize the application for a developer's machine, a test server, or production. Remember to activate the appropriate configuration; frameworks often provide commands for it. When investigating a bug, check the active environment too, especially for "it works on my machine but not on the server." Test environments are usually less restrictive. In production, errors may be treated as actual errors rather than warnings, while PHP, MySQL, and other components probably have stricter security and performance settings. Keep this in mind and try to align servers where possible, so problems appear during testing and properly working applications reach production.
How do you edit a text file?
The jokes about Vi and Vim are not baseless. This brings me back to university training and something said in my second semester that stayed with me: if you can find your way around Vi, you can cope on any server. That is true because practically every environment provides at least this editor. As the jokes suggest, it causes trouble for most people. No, I do not mean Vi from League of Legends.
A handful of shortcuts is enough for basic editing. Mastering Vi or Vim, its enhanced version that I recommend, takes time, but everyday use only requires:
- I, uppercase: enter insert mode to edit text.
- ESC: leave insert mode.
- /phrase: search for a string, then move between matches with "n."
- :linenumber: go to a particular line.
- G, uppercase: go to the end of the file, useful for logs.
- gg, two lowercase g characters: go to the start.
- :%s/foo/bar/g: replace every occurrence of "foo" with "bar."
- :q: exit normally.
- :q!: exit without saving.
- :w: save changes.
- ZZ, two uppercase Z characters: save and exit.
How do we open the editor? Simply:
vim file #lub vi file
Open the file with appropriate permissions. After making many changes, you might otherwise discover that it was read-only all along because you did not use sudo, discussed shortly. Pay attention to this.
Other editing options exist too. Many servers offer the potentially simpler Nano editor, and graphical editing through WinSCP is always another possibility.
You need not always edit a file; sometimes viewing it is enough. Several commands can do this:
cat file.txt: print the contents to the screen.tail -n NUM file.txt: print the last NUM lines, particularly useful for long logs.less file.txt: display the file in sections, advancing with the space bar.
Permissions and using sudo
One thing should be clear: on most servers, developers never receive superuser privileges, let alone root, the system's main administrator account. Administrators will not let another technical person change services and potentially break the server or install unauthorized software. That is reasonable. Looking after the server is the administrator's job, and someone else "interfering" makes that difficult. Users instead receive access to selected parts of the system, programs, and specific commands.
On some machines, developers do have superuser privileges. The important distinction is having privileges rather than being root. To run a command with those privileges, prefix it with sudo and enter your password:
sudo cp /var/logs/nginx .
Where possible, prefix individual commands with sudo rather than switching accounts once with sudo su. You type 5 extra characters each time, but reduce the scope for mistakes.
I will not discuss root further, since it is usually off limits to developers. If you need that information because you actually work as root, your requirements and knowledge probably exceed this article's scope.
Linux permissions deserve a brief explanation. Here is an example directory listing produced by ls -l:
Each entry has ten characters on the left. These are its permissions, read as follows:
- The first character indicates a directory with "d," or a symbolic link, a shortcut to a file, with "l."
- Characters 2 through 4 show read (r), write (w), and execute (x) permissions for the owner. A hyphen means the permission has not been granted.
- Characters 5 through 7 show the same permissions for the user's group.
- Characters 8 through 10 describe permissions for other users.
You may recognize commands such as:
chmod 0664 file.txt
This grants specific permissions using octal notation. Read (r) is 4, write (w) is 2, and execute (x) is 1. The command therefore grants read and write to the owner and group, the two sixes being 4 + 2, and only read to other users, represented by 4. The leading zero indicates octal. Permissions can also be set using letters, such as g-w, but we will skip that to avoid further confusion, along with the wider subject of owners and groups.
How do you find out what is happening?
When something goes wrong, the first place to check is usually the logs. They may be collected at different levels:
- Application logs: within the application directory, at a framework-specific location. Yii 2.0 uses
runtime/logsin the relevant subapplication; Laravel usesstorage/logs. - HTTP server logs: Apache2 or NGINX collects its own logs, often in an appropriate directory under
/var/logs. Since users usually cannot access it directly, a link to the log directory is often also available in the user's home directory. - PHP logs: the interpreter has logs for incorrect language use, such as syntax problems, rather than necessarily framework misuse. Look under
/var/logshere too.
Many other services, including databases, produce logs. The ones above are simply those monitored most often and provide invaluable information.
Domains and virtual hosts
We have mentioned virtual hosts several times. Now it is time to explain them.
Our server usually has one IP address. Even if we do not use it explicitly because a domain such as sX.mydevil.net or serwerXXXXXX.home.pl points to it, that IP will appear somewhere, for example when we run ping [adresdomenowy], replacing the bracketed placeholder with the domain name. Entering the IP or even the server's domain in a browser will usually not display our website. Why? One machine commonly hosts dozens of websites, so we need to specify which one we mean. It is like approaching a hospital reception and saying we want to see a patient. The essential question is: "Which patient?"
Both "strona1.pl" and "strona2.pl" may point to the same server. Opening them in separate browser tabs actually sends requests to the same machine, which serves the appropriate website based on the address. Virtual hosts configured in the HTTP server define the routes. It knows that "strona1.pl" should lead to a particular directory of files. In our hospital comparison, the patient's room number is the virtual host.
How does the server know that a request for "strona1.pl" is meant for it? This is a domain address, or simply a domain, purchased independently of the server. More attractive names can cost more. Each domain has associated DNS records (Domain Name Server), pointing to the appropriate IP address, our server. After editing, records must propagate among other servers, which can take from 30 minutes to two days. One part of configuration is therefore pointing the domain correctly, often done by the client. If a developer does it, they need access to the domain control panel. The other part defines routes on the server so the HTTP server knows where requests belong. Two or more addresses can also point to one application directory, where functionality differs according to the requested address.
There are also subdomains, rather like subdirectories of domains, except that they come at the beginning. Examples for "strona1.pl" include "admin.strona1.pl" and "panel.strona1.pl." This is a practical, elegant way to simplify domain management and save money. It is certainly simpler to configure than paths after a slash, such as "strona1.pl/admin" or "strona1.pl/panel."
Running background processes
Running ps, or the more detailed ps alx, on Linux shows running processes. We usually see Bash itself, the service responsible for the terminal, and other entries according to our permissions. This can reveal a process that has become stuck and is causing problems.
Sometimes we need to start a program directly from the command line, bypassing the HTTP server or another serving application. How can it run in the background without blocking the terminal? Remember that we can open several consoles in different tabs, but knowing another way is useful.
One approach uses CTRL+Z and the bg and fg commands. A seemingly simpler method is nohup, which runs the process in the background and collects logs in nohup.out. For example:
nohup symfony server:start
More approaches and detailed explanations are available here.
Cron
Some tasks need to run periodically. Cron handles this, running in the background and checking its table every minute for commands due to execute. Configure it by opening the table in your preferred editor, such as Vim, with:
crontab -e
We can then add tasks with their execution times or frequency. For example:
30 1 * * * echo "1" > file.txt
This writes "1" to file.txt every day at 1:30 a.m. The first five fields mean, in order: minute, hour, day of the month, month, and day of the week. An asterisk means any value, or every value. A slash can also be used, as in */5, to mean every 5 minutes, hours, days, or months, depending on the field.
Cron expressions can be difficult for beginners. Online resources such as this simple guide can help.
How should you learn?
Speaking of learning, where should a junior developer seek help when stuck on a particular command?
Linux includes a manual accessed through man, short for manual. Add a command, such as man cp, to see its help page with syntax and available options. The same material is available online, for example here. This is useful when you know which tool you want but not exactly how to use it.
Sometimes we cannot work out which method to use at all. Then there is the wealth of knowledge online: forums, advice articles, and sites such as Stack Overflow. Searching is nothing to be ashamed of. Understanding different ways to achieve a goal can be harder, but that comes with experience.
The most important thing is not to be afraid to try. I do not mean recklessly running uncertain commands on a server and hoping for the best. Instead, spend time working with a test Linux instance. You need not install Linux directly on your computer: virtual machines and solutions such as WSL provide access to a Linux-like environment without a full installation. This builds substantial knowledge and familiarity. You simply have to be willing to try.
Conclusion
I know this article has not covered every aspect of maintaining an application on a Linux hosting server. It omits firewalls, HTTP server configuration, uploading users' public keys, containerization, regular expressions, and more. The aim was not a complete server administration reference, especially since users often lack access to many functions anyway. Technologies and hosting services vary too much to examine every possibility. Too much information could also overwhelm the junior developers this article is intended for.
I hope this guide has helped you understand what happens on the server hosting your team's application. The aim was to help you feel confident and navigate the filesystem and services effectively. This is only the tip of the iceberg, of course. There is much more to learn, and each project and server will add to your knowledge. I sincerely hope that happens for you.
Best regards, and thank you. Jakub Rojek.


