SMF - Just Installed!
mysql -uroot -p
CREATE DATABASE site1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON site1.* TO dbuser@localhost IDENTIFIED BY 'password' WITH GRANT OPTION;
quit
TMP_SITE=site1.local
nano /etc/nginx/sites-enabled/$TMP_SITE.conf
server {
listen 80;
server_name site1.local www.site1.local;
set $root_path /var/www/site1.local/www;
access_log /var/www/site1.local/log/nginx/access_log;
error_log /var/www/site1.local/log/nginx/error_log;
gzip on;
gzip_disable "msie6";
gzip_min_length 1000;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
root $root_path;
index index.php index.html index.htm;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|docx|xls|xlsx|exe|pdf|ppt|tar|wav|bmp|rtf|js)$ {
expires modified +1w;
}
}
server {
listen 80;
server_name site1.local www.site1.local;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/cert.key;
server_name site1.local www.site1.local;
set $root_path /var/www/site1.local/www;
access_log /var/www/site1.local/log/nginx/access_log;
error_log /var/www/site1.local/log/nginx/error_log;
gzip on;
gzip_disable "msie6";
gzip_min_length 1000;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
root $root_path;
index index.php index.html index.htm;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|docx|xls|xlsx|exe|pdf|ppt|tar|wav|bmp|rtf|js)$ {
expires modified +1w;
}
}
nano /etc/apache2/sites-enabled/$TMP_SITE.conf
<VirtualHost *:8080>
Define root_domain site1.local
Define root_path /var/www/site1.local
ServerName ${root_domain}
ServerAlias www.${root_domain}
DocumentRoot ${root_path}/www
ErrorLog ${root_path}/log/apache/error_log
TransferLog ${root_path}/log/apache/access_log
php_admin_value upload_tmp_dir ${root_path}/tmp
php_admin_value doc_root ${root_path}
php_admin_value open_basedir ${root_path}:/usr/local/share/smarty:/usr/local/share/pear
php_admin_value session.save_path 0;0660;${root_path}/tmp
</VirtualHost>
mkdir -p /var/www/$TMP_SITE/{www,tmp}
mkdir -p /var/www/$TMP_SITE/log/{nginx,apache}
nano /var/www/$TMP_SITE/www/index.php
<?php echo "<h1>Hello from site1</h1>"; ?>
chown -R www-data:www-data /var/www/$TMP_SITE
chmod -R 775 /var/www/$TMP_SITE
nginx -t
apachectl configtest
systemctl reload nginx
systemctl reload apache2
nano /etc/php/8.1/apache2/php.ini
post_max_size = 1G
...
upload_max_filesize = 512M
...
short_open_tag = On
...
date.timezone = "Europe/Moscow"
PHP_VER=8.1
INT=apache2
sed -e "s/post_max_size = 8M/post_max_size = 1G/" -i /etc/php/$PHP_VER/$INT/php.ini
sed -e "s/upload_max_filesize = 2M/upload_max_filesize = 512M/" -i /etc/php/$PHP_VER/$INT/php.ini
sed -e "s/short_open_tag = Off/short_open_tag = On/" -i /etc/php/$PHP_VER/$INT/php.ini
sed -e "s/;date.timezone =/date.timezone ='Europe\/Moscow'/" -i /etc/php/$PHP_VER/$INT/php.ini
cat /etc/php/$PHP_VER/$INT/php.ini | grep -e "^post_max_size\|^upload_max_filesize\|^short_open_tag\|^date.timezone"
INT=fpm
sed -e "s/post_max_size = 8M/post_max_size = 1G/" -i /etc/php/$PHP_VER/$INT/php.ini
sed -e "s/upload_max_filesize = 2M/upload_max_filesize = 512M/" -i /etc/php/$PHP_VER/$INT/php.ini
sed -e "s/short_open_tag = Off/short_open_tag = On/" -i /etc/php/$PHP_VER/$INT/php.ini
sed -e "s/;date.timezone =/date.timezone ='Europe\/Moscow'/" -i /etc/php/$PHP_VER/$INT/php.ini
cat /etc/php/$PHP_VER/$INT/php.ini | grep -e "^post_max_size\|^upload_max_filesize\|^short_open_tag\|^date.timezone"
systemctl restart php8.1-fpm
systemctl restart apache2
nano /etc/nginx/nginx.conf
client_max_body_size 512M;
systemctl reload nginx
apt install postfix -y
nano /etc/postfix/main.cf
myorigin = $mydomain
smtp_generic_maps = hash:/etc/postfix/generic_map
nano /etc/postfix/generic_map
@example.org no-reply@example.org
postmap /etc/postfix/generic_map
systemctl enable postfix
systemctl restart postfix
nano /etc/apache2/mods-available/remoteip.conf
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1/8
</IfModule>
a2enmod remoteip
systemctl restart apache2
nano /etc/nginx/sites-enabled/default
location ~ \.php$ {
set $root_path /var/www/html;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT $root_path;
}
location ~ \.php$ {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
nginx -t
systemctl reload nginx
apt install apache2 libapache2-mod-php
nano /etc/apache2/ports.conf
Listen 8080
#<IfModule ssl_module>
# Listen 443
#</IfModule>
#<IfModule mod_gnutls.c>
# Listen 443
#</IfModule>
nano /etc/apache2/mods-available/dir.conf
<IfModule dir_module>
DirectoryIndex index.php index.html ...
</IfModule>
nano /etc/apache2/apache2.conf
<Directory /var/www/*/www>
AllowOverride All
Options Indexes ExecCGI FollowSymLinks
Require all granted
</Directory>
<IfModule setenvif_module>
SetEnvIf X-Forwarded-Proto https HTTPS=on
</IfModule>
a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php8.1
a2enmod setenvif
a2enmod rewrite
systemctl enable apache2
systemctl restart apache2
apt install proftpd
id www-data
ftpasswd --passwd --file=/etc/proftpd/ftpd.passwd --name=ftpwww --uid=33 --gid=33 --home=/var/www --shell=/usr/sbin/nologin
nano /etc/proftpd/proftpd.conf
DefaultRoot ~
nano /etc/proftpd/conf.d/custom.conf
UseIPv6 off
IdentLookups off
PassivePorts 60000 65535
RequireValidShell off
AuthUserFile /etc/proftpd/ftpd.passwd
AuthPAM off
LoadModule mod_auth_file.c
AuthOrder mod_auth_file.c
systemctl enable proftpd
systemctl restart proftpd
apt install memcached php-memcached
systemctl enable memcached
systemctl restart php8.1-fpm
apt install phpmyadmin
nano /etc/nginx/sites-enabled/phpmyadmin.conf
server {
listen 80;
server_name phpmyadmin.example.org;
set $root_path /usr/share/phpmyadmin;
root $root_path;
location / {
index index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT $root_path;
}
}
nano /etc/nginx/sites-enabled/default
server {
listen 80 default_server;
...
location /phpmyadmin {
root /usr/share/;
index index.php;
location ~ ^/phpmyadmin/(.+\.php)$ {
root /usr/share/;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
systemctl reload nginx