-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrupal_apache_postgres.txt
126 lines (83 loc) · 3.39 KB
/
drupal_apache_postgres.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
============================
Drupal + Apache + PostgreSQL
============================
- https://www.howtoforge.com/tutorial/how-to-install-drupal_8-with-apache-and-ssl-on-ubuntu-15-10/
**Tested on Ubuntu Xenial (16.04)**
Install prerequirements::
sudo apt update
sudo apt install postgresql apache2 php libapache2-mod-php7.0 php7.0-gd php7.0-xml php7.0-pgsql
a2enmod rewrite ssl
systemctl restart apache2
# check ssl, rewrite
apache2ctl -M | egrep 'ssl|rewrite'
Download end extract drupal::
cd /var/www/
wget https://ftp.drupal.org/files/projects/drupal-8.2.2.tar.gz
tar -xvzf drupal-8.2.2.tar.gz
mv drupal-8.2.2 drupal
chown www-data:www-data -R drupal/
Apache configuration
--------------------
SSL::
mkdir /etc/apache2/ssl
# generate a self-signed SSL certificate
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/drupalssl.key -out /etc/apache2/ssl/drupalssl.crt
sudo chmod 600 /etc/apache2/ssl/*
Create virtual host config ``/etc/apache2/sites-available/drupal.conf``::
<VirtualHost *:80>
ServerName www.mydrupal.co
DocumentRoot /var/www/drupal
# Redirect http to https
RedirectMatch 301 (.*) https://www.mydrupal.co$1
</VirtualHost>
<VirtualHost _default_:443>
# Server Info
ServerName www.mydrupal.co
ServerAlias mydrupal.co
ServerAdmin webmaster@localhost
# Web root
DocumentRoot /var/www/drupal
# Log configuration
ErrorLog ${APACHE_LOG_DIR}/drupal-error.log
CustomLog ${APACHE_LOG_DIR}/drupal-access.log combined
# Enable/Disable SSL for this virtual host.
SSLEngine on
# Self signed SSL Certificate file
SSLCertificateFile /etc/apache2/ssl/drupalssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/drupalssl.key
<Directory "/var/www/drupal">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<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
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
Enable new virtual host::
# check config
apachectl configtest
# enable new host
a2ensite drupal
# disable default host config
a2dissite 000-default
systemctl restart apache2
DB Postgres for drupal
----------------------
Create DB and User for Drupal::
su - postgres
psql
CREATE USER drupal WITH password 'PASSWORD';
CREATE DATABASE drupal OWNER drupal;
GRANT ALL privileges ON DATABASE drupal TO drupal;
exit
psql -h localhost drupal drupal
ALTER DATABASE "drupal" SET bytea_output = 'escape';