📜 ⬆️ ⬇️

Debian: Apt-Pinning using php5-fpm and nginx 1.0.4 as an example (Debian way)

All Debian users know that Debian is as stable as it slows down on the "new items". In particular, the php5-fpm package, so much loved, is still not in the stable repository. Having decided to search a bit, as people do, I realized that many people collect it from “sorts”. I somehow didn’t like it. So today I put it in the style of Debian-way, using Apt-Pinning.

Apt-Pinning, in short, is a technology that shows from which repository it is preferable to package.

Everything is done very simply.

We add the testing and unstable repositories in /etc/apt/sources.list .
Carefully, spaces are made in the URL after http :. They should not be there
# deb http: //ftp.ru.debian.org/debian/ squeeze main
')
deb http: //ftp.ru.debian.org/debian/ squeeze main non-free contrib
deb-src http: //ftp.ru.debian.org/debian/ squeeze main non-free contrib

#security
deb http: //security.debian.org/ squeeze / updates main contrib non-free
deb-src http: //security.debian.org/ squeeze / updates main contrib non-free

# squeeze-updates, previously known as 'volatile'
deb http: //ftp.ru.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http: //ftp.ru.debian.org/debian/ squeeze-updates main contrib non-free

#UNSTABLE
deb http: //ftp.ru.debian.org/debian/ unstable main non-free contrib
deb-src http: //ftp.ru.debian.org/debian/ unstable main non-free contrib

#TESTING
deb http: //ftp.ru.debian.org/debian/ testing main non-free contrib
deb-src http: //ftp.ru.debian.org/debian/ testing main non-free contrib


Next, create the file / etc / apt / preferences
# Updating PHP5 and NGINX
# The Pin-Priority field tells you which repository from which packages to take
# Packages php5-fpm, nginx and everything auxiliary is better to take from stable, then search in testing, and then in unstable if it fits.
# PHP5, NGINX
Package: php5-fpm nginx php5-common libpcre3 nginx-full libgeoip1
Pin: release a = stable
Pin-Priority: 700

Package: php5-fpm nginx php5-common libpcre3 nginx-full libgeoip1
Pin: release a = testing
Pin-Priority: 650

Package: php5-fpm nginx php5-common libpcre3 nginx-full libgeoip1
Pin: release a = unstable
Pin-Priority: 600

#OTHER
Package: *
Pin: release a = stable
Pin priority: 550

#OTHER
Package: *
Pin: release a = testing
Pin priority: 500



Making a “pen test”
sudo apt-get update
# The -s flag means Simulation. With proper setup, you will have some packages to upgrade.
sudo apt-get -s upgrade
# Look carefully at the packages.
sudo apt-get -s install php5-fpm nginx
# Look carefully at the dependencies that cause problems and add them to the Package from the first three
sudo apt-get -s install php5-fpm nginx
# Make a simulation until it seems that everything is fine, if something goes wrong - we rule the APT configs

# Install nginx and php5-fpm
sudo apt-get install php5-fpm nginx
sudo /etc/init.d/php5-fpm start
sudo /etc/init.d/nginx start

Go to http: // our IP, nginx should greet you!

Enable PHP:
sudo echo '<? php phpinfo (); ?> '> /usr/share/nginx/www/info.php
Rule / etc / nginx / sites-available / default
sudo nano -w / etc / nginx / sites-available / default
We cut in fcgi_pass in the config: look for (CTRL + W) the line "9000" and uncomment the whole block, except for the comment. We correct for themselves.
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {
fastcgi_pass unix:/var/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

Restart nginx
sudo /etc/init.d/nginx restart
Come http: // our IP / info.php
Voila

Source: https://habr.com/ru/post/120943/


All Articles