Drupal на Debian Jessie

Добавляем репозиторий
vim /etc/apt/sources.list:

deb http://ftp.ua.debian.org/debian/ jessie main


aptitude update
aptitude -y install openssl drupal7 iptables-persistent

vim /etc/apache2/sites-available/000-default.conf:

<VirtualHost *:80>
        ServerName example.com
        ServerAdmin admin@example.com
        DocumentRoot /usr/share/drupal7/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

vim /etc/apache2/sites-available/default-ssl.conf:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@example.com
                DocumentRoot /usr/share/drupal7/
                Options FollowSymLinks ExecCGI
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/ssl/private/example.com.crt
                SSLCertificateKeyFile   /etc/ssl/private/example.com.key
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
                BrowserMatch "MSIE [2-6]" \
                                nokeepalive ssl-unclean-shutdown \
                                downgrade-1.0 force-response-1.0
                BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
        </VirtualHost>
</IfModule>

Генерируем самоподписные сертификаты SSL
cd /etc/ssl/private
openssl genrsa -des3 -out example.com.key 2048
openssl rsa -in server.key -out example.com.key
openssl req -new -days 36500 -key example.com.key -out example.com.csr
openssl x509 -in example.com.csr -out example.com.crt -req -signkey example.com.key -days 3650
chmod 400 example.com.*

Создаём папку для нашего сайта и настройки по умолчанию:
cd /usr/share/drupal7/sites/
mkdir example.com
cp -a default/* example.com
vim example.com/dbconfig.php:

<?php
$databases['default']['default'] = array(
        'driver' => 'mysql',
        'database' => 'drupal',
        'username' => 'drupal',
        'password' => 'drupaldbpass',
        'host' => 'localhost',
        'port' => '',
        'prefix' => ''
);

?>

chown -R www-data:www-data /usr/share/drupal7

Создаём базу данных для drupal:
mysql -u root -p
create database drupal;
GRANT ALL ON drupal.* TO drupal@localhost IDENTIFIED BY 'drupaldbpass';
quit;

a2enmod ssl rewrite
a2ensite default-ssl
invoke-rc.d apache2 restart

Запускаем установку drupal
https://example.com/install.php

Открываем порты
iptables -I INPUT 1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I INPUT 2 -s 192.168.0.0/24 -d 192.168.0.1 -i eth0 -p tcp -m state --state NEW -m multiport --dports 80,443 -j ACCEPT
invoke-rc.d netfilter-persistent save

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *