P
P
PlatinumArcade2012-07-28 01:30:17
PHP
PlatinumArcade, 2012-07-28 01:30:17

How to learn how to set up a web server under Linux?

I have been making websites (html + php + js) for 5 years already. But not boom-boom at all in installing and configuring Apache, nginx, php, mysql, when there is root access.
The support of the hosting provider always helps me with this. The maximum I can do is to go to the console via SSH, top look =)
Maybe there are some video tutorials? Or what is the most efficient way to do it? At least I will learn how to put everything I need on a clean OS + admin panel.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
D
dinix, 2012-07-28
@PlatinumArcade

How to learn? The first couple of times put according to the instructions from Google. Even if not all steps are clear. Google the problems that arise, they are basically the same for everyone. Then read the comments inside the configuration files, it will gradually become clear what most of the options in the configs are responsible for. The only thing is to make sure that the indexes are closed and that .htaccess files are not visible from the outside, so as not to unknowingly screw up security.
Some of the parameters in the nginx, apache, mysql configs are adjusted to your needs and to the server parameters, you will understand when they need to be tweaked (for example, MaxClients in Apache, mysql cache sizes).
Oh, and in the admin. panels, immediately remove the default login / password, do not hope that no one cares and will not break.

V
Vyacheslav Plisko, 2012-07-28
@AmdY

There are a lot of benefits, just google or read the same Habr. Now a great series of articles is being published directly on Habré habrahabr.ru/post/147864/ . Or a very simple www.unixmen.com/install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat/
But does it make sense. Admins do not eat their bread with caviar in vain, it is difficult to approach their level.

N
Nazar Mokrinsky, 2012-07-28
@nazarpc

The configuration is a little bit, but depends on the distribution.
For example, Ubuntu:
apt-get install apache2 php5 mysql-client mysql-server phpmyadmin libapache2-mod-php5 php5-mysql
This line will install Apache2, PHP5, MySQL client and server, Apache2 php5 module and php5 MySQL module. It's not hard to figure out the lines.
The most commonly needed modules are GD or Imagick (for images), Mcrypt and Mhash (for encryption and hashing), and PhpMyAdmin:
apt-get install php5-gd php5-imagick php5-mcrypt php5-mhash phpmyadmin
Can be combined with the previous commands.
If you are not running as root, add sudo to the beginning of the line (for Ubuntu).
To configure the sites themselves - see the /etc/apache2/sites-available/default example, copy it with a new name, and run the file name in the console a2ensite , then service apache2 reload - load the new configuration.
Add the line 127.0.0.1 domain_name to the /etc/hosts file and you're done.
For convenience, you can install the mc file manager (the package name and the launch command are also mc, as described above). On other distributions, the package manager (the one that apt-get) may change, but in general the same thing.
For more complex situations, read the documentation/examples of the apache config file. To install nginx, it's basically the same, just slightly different packages, and a different configuration file.
I sketched a short manual in the simplest form, there are many more on the net. Try installing Ubuntu Server (or even Desktop to start with, to make it easier to navigate) on a local virtual machine and give it a try.

S
Stdit, 2012-07-28
@Stdit

Experiments and training are best done in a virtual machine (I did just that). For example, install VirtualBox, install CentOS there (for this you need to download the iso of the installation disk, insert it into a virtual drive and boot the virtual machine from it, the installer is interactive and does not cause difficulties, after installation everything usually works right away. Port forwarding may be required, this is done through the right-click menu of the virtual machine, for example, to work through the terminal program, you need to forward port 22, and to open the site from virtual virtual in the browser - port 80. You can also forward to another host port, for example 8080, if suddenly you, for example, have your developer Apache already hanging there). During installation, you can immediately select software packages, but in order to learn how to install software and manage the server, it is better not to select anything.
Installing all the web goodness with yum is not difficult, you can start with the "yum help" command. Unless, perhaps, you need to install some additional repositories (epel, remi, centalt, a lot has been written about this and is easy to google). In most cases, it is enough to search through the repositories (yum list php *) and install what you need via yum install, as well as launch via "service name start". Autostart of installed services can be controlled via chkconfig, such as "chkconfig mysqld off". (of course, basic console commands for managing files and rights, such as cat, cp, mv, rm, chmod, chown, ls, mkdir, find, etc. - you need to know if this knowledge is not there either, it is better to start with them, you may also need knowledge in managing the iptables firewall, but first you can turn it off, “service iptables stop”).
Configs of installed services will be in most cases in the directory /etc/software name. Configuring each installed package may no longer be such a trivial task, each will have its own nuances, and you will need to look for relevant information from comments in the config to thematic forums. Modules for php are installed via "yum php-pecl-name nistall" or via pecl (see "pecl help"). Accordingly, for pear - "pear help".
This is basic information, which at one time I really lacked to facilitate the “start”. I hope you find it useful.

S
Stdit, 2012-07-28
@Stdit

hotfix: "yum install php-pecl-name"

O
olexande, 2014-01-08
@olexande

There are several options.
For a start it is desirable to be defined with the distribution kit. This is due to the fact that different software can be used under different distributions for the same software.
Then figure out how to install software for the selected distribution.
There are several web servers (popular) that can be used to host web sites.
You don't need to install js for the "(html + php + js)" bundle on the server side, but the programmer doesn't need to explain it ;)
Just try to install any software.
Further, I would recommend simply putting a bunch of Apache + php. Or nginx + php.
And try to run. As a result, the corresponding process should appear in the processes. And the server should start listening on the "network port".
After the successful installation of a simple bundle, it will already be possible to switch to more complex bundles, simply by additionally installing the missing software. And/or adding missing modules to the existing one.
ZYZH I also recommend not to forget about the opportunity to study on virtual machines. It is not necessary to allocate a separate (iron server). At least at the beginning.

L
Lev Kekish, 2014-12-27
@levik200

My God, but not Lamp, better handles yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question