sudo -i
apt install -y apache2
-y
it is necessary so that during the installation process, it automatically answers all questions positively. For example, if you run: apt install apache2
apt install -y php libapache2-mod-php
apt update
apt install -y make \ git autoconf \ lynx \ wget \ build-essential \ libxml2-dev \ libssl-dev \ libbz2-dev \ libcurl4-openssl-dev \ libpng12-dev \ libfreetype6-dev \ libxpm-dev \ libmcrypt-dev \ libmhash-dev \ libmysqlclient-dev \ libjpeg62-dev \ freetds-dev \ libjson-c-dev \ re2c \ zlib1g-dev \ libpcre3 \ libpcre3-dev \ unzip \ libxslt1-dev
mkdir -p /opt/source/php mkdir -p /opt/php/
cd /opt/source/php
wget -c http://php.net/get/php-5.6.18.tar.bz2/from/this/mirror -O php-5.6.18.tar.bz2 tar xvjf php-5.6.18.tar.bz2
cd /opt/source/php/php-5.6.18
./configure --enable-cli \ --prefix=/opt/php/php-5.6.18 \ --disable-rpath \ --enable-calendar \ --enable-discard-path \ --enable-fastcgi \ --enable-force-cgi-redirect \ --enable-fpm \ --enable-ftp \ --enable-gd-native-ttf \ --enable-inline-optimization \ --enable-mbregex \ --enable-mbstring \ --enable-pcntl \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-zip \ --with-bz2 \ --with-curl \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gd \ --with-gettext \ --with-jpeg-dir \ --with-jpeg-dir=/usr/lib/ \ --with-libdir=/lib/x86_64-linux-gnu \ --with-libxml-dir=/usr \ --with-mcrypt \ --with-mhash \ --with-mysql \ --with-mysql \ --with-mysqli \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-png-dir=/usr \ --with-zlib \ --with-zlib-dir
make make install
/opt/php/php-5.6.18/bin/php -v
apt install libapache2-mod-fcgid a2enmod cgi fcgid actions
service apache2 restart
mkdir -p /opt/php/php-5.6.18/fcgi-bin
#!/opt/php/php-5.6.18/bin/php-cgi
. I personally use the nano editor. nano /opt/php/php-5.6.18/fcgi-bin/php
chmod +x /opt/php/php-5.6.18/fcgi-bin/php
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <IfModule mod_fcgid.c> IPCCommTimeout 7200 FcgidConnectTimeout 320 MaxRequestLen 25728640 FcgidMaxRequestsPerProcess 0 FcgidBusyTimeout 3600 FcgidOutputBufferSize 0 </IfModule> <FilesMatch "\.ph(p[3-5]?|tml)$"> SetHandler fcgid-script FCGIWrapper /opt/php/php-5.6.18/fcgi-bin/php </FilesMatch> ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost> <Directory /var/www/html> Options +Includes +ExecCGI </Directory>
service apache2 reload
apt install apache2-suexec-custom a2enmod suexec
|--/var/www/ - , 751 root
|----/php-bin - php
|------/php-5.6.18 - php-5.6.18
|--------php - php-5.6.18
|--------php.ini -
|--------php.ini -
|----/apache-cert - apache
mkdir -p /var/www/users/admin mkdir -p /var/www/users/admin/domain.ru mkdir -p /var/www/users/admin/apache-log mkdir -p /var/www/users/admin/php-bin mkdir -p /var/www/users/admin/temp mkdir -p /var/www/users/admin/temp/php-session
cp /opt/php/php-5.6.18/fcgi-bin/php /var/www/users/admin/php-bin/php cp /opt/php/php-5.6.18/fcgi-bin/php.ini /var/www/users/admin/php-bin/php.ini
useradd -m -s /bin/bash admin passwd admin
chown admin:admin -R /var/www/users/admin
usermod -d /var/www/users/admin admin
<VirtualHost *:8080> ServerAdmin webmaster@localhost DocumentRoot /var/www/users/admin/domain.ru SuexecUserGroup admin admin <IfModule mod_remoteip.c> RemoteIPHeader X-Forwarded-For RemoteIPHeader X-Real-IP RemoteIPInternalProxy 127.0.0.1 </IfModule> <ifmodule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}] </ifmodule> <IfModule mod_fcgid.c> IPCCommTimeout 7200 FcgidConnectTimeout 320 MaxRequestLen 25728640 FcgidMaxRequestsPerProcess 0 FcgidBusyTimeout 3600 FcgidOutputBufferSize 0 </IfModule> <FilesMatch "\.ph(p[3-5]?|tml)$"> SetHandler fcgid-script FCGIWrapper /var/www/users/admin/php-bin/php </FilesMatch> ErrorLog /var/www/users/admin/apache-log/error.log CustomLog /var/www/users/admin/apache-log/access.log combined </VirtualHost> <Directory /var/www/users/admin/www> AllowOverride All Options +Includes +ExecCGI </Directory>
session.save_path = /var/www/users/admin/temp/php-session
service apache2 restart
/etc/apache2/ports.conf +
service apache2 restart
apt-get install nginx
apt install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip libxslt1-dev libgd-dev libgeoip-dev
mkdir -p /opt/source/nginx cd /opt/source/nginx
wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.11.33.4-beta.zip unzip v1.11.33.4-beta.zip cd ngx_pagespeed-1.11.33.4-beta wget https://dl.google.com/dl/page-speed/psol/1.11.33.4.tar.gz tar -xzvf 1.11.33.4.tar.gz
cd /opt/source/nginx
nginx -V
wget https://nginx.ru/download/nginx-1.10.0.tar.gz tar -xvzf nginx-1.10.0.tar.gz
cd /opt/source/nginx/nginx-1.10.0 ./configure \ --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads \ --add-module=/opt/source/nginx/ngx_pagespeed-1.11.33.4-beta \ --with-http_mp4_module
make make install
service nginx stop
mv /usr/sbin/nginx /usr/sbin/nginx_backup
mv /opt/source/nginx/nginx-1.10.0/objs/nginx /usr/sbin/nginx
service nginx start
/var/www/temp/ /var/www/temp/page-speed/
pagespeed on; pagespeed FileCachePath "/var/www/temp/page-speed/"; pagespeed EnableFilters combine_css,combine_javascript,rewrite_images,rewrite_css,rewrite_javascript,inline_images,recompress_jpeg,recompress_png,resize_images; pagespeed JpegRecompressionQuality 85; pagespeed ImageRecompressionQuality 85; pagespeed ImageInlineMaxBytes 2048; pagespeed LowercaseHtmlNames on;
server { listen 80; server_name domain.ru; access_log /var/log/nginx.access_log; location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)$ { root /var/www/users/admin/domain.ru; index index.html index.php; access_log off; expires 30d; error_page 404 = @prox; } location @prox{ proxy_pass 127.0.0.1:8880; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-for $remote_addr; proxy_set_header Host $host; proxy_connect_timeout 60; proxy_send_timeout 90; proxy_read_timeout 90; proxy_redirect off; proxy_set_header Connection close; proxy_pass_header Content-Type; proxy_pass_header Content-Disposition; proxy_pass_header Content-Length; } location ~ /\.ht { deny all; } location / { proxy_pass 127.0.0.1:8880; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-for $remote_addr; proxy_set_header Host $host; proxy_connect_timeout 60; proxy_send_timeout 90; proxy_read_timeout 90; proxy_redirect off; proxy_set_header Connection close; proxy_pass_header Content-Type; proxy_pass_header Content-Disposition; proxy_pass_header Content-Length; } }
Source: https://habr.com/ru/post/330772/
All Articles