Skip to content

Instantly share code, notes, and snippets.

@alksily
Created March 1, 2019 12:20
Show Gist options
  • Save alksily/437f67e72ad44d8833abd946feb3e3b8 to your computer and use it in GitHub Desktop.
Save alksily/437f67e72ad44d8833abd946feb3e3b8 to your computer and use it in GitHub Desktop.
Debian Nginx+PHP7+MySQL+Redis

Add additional repositories by edit file /etc/apt/sources.list for each link add contrib non-free after main

Update:
apt-get update

Optional:
apt-get install mc htop build-essential

Install one command line:
apt-get install nginx-extras php7.0-cli php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-sybase php7.0-mbstring php7.0-redis redis-server mysql-server mysql-client

Add nginx vhost file:
mcedit /etc/nginx/conf.d/com.example.conf

server {
    listen 80 default_server;
    server_name example.com;

    charset utf-8;
    #access_log /var/log/nginx/log/host.access.log  main;
    root /path/to/htdocs/dir;

    location / {
        try_files $uri /index.php$is_args$args;
        autoindex on;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #fastcgi_index index.php;
        fastcgi_split_path_info ^(.+.php)(.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_read_timeout 600;
    }
}

Configure PHP by edit php.ini:
mcedit /etc/php/7.0/fpm/php.ini

Change short_open_tag from Off to On
Change post_max_size from 8M to 100M
Change upload_max_filesize from 2M to 100M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment