Last active
December 8, 2017 18:30
-
-
Save igodorogea/bd739926def35ae6237049db424110ee to your computer and use it in GitHub Desktop.
Setup Ubuntu for TYPO3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt update -y | |
sudo apt upgrade -y | |
sudo apt install zsh git-core | |
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh | |
sudo chsh -s $(which zsh) ubuntu | |
sudo apt install -y nginx | |
sudo service nginx status | |
nginx -v | |
sudo apt install -y mariadb-server mariadb-client | |
sudo mysql_secure_installation | |
mysql --version | |
sudo apt install -y python-software-properties | |
sudo add-apt-repository -y ppa:ondrej/php | |
sudo apt update -y | |
sudo apt install -y php7.1-dev php7.1-fpm php7.1-cli php7.1-common php7.1-soap php7.1-xml php7.1-zip php7.1-mbstring php7.1-bcmath php7.1-curl php7.1-gd php7.1-intl php7.1-json php7.1-mcrypt php7.1-mysql php7.1-readline php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl | |
sudo echo '' | sudo pecl -q install apcu | |
echo "extension = apcu.so" | sudo tee -a /etc/php/7.1/mods-available/apcu.ini | |
sudo ln -s /etc/php/7.1/mods-available/apcu.ini /etc/php/7.1/fpm/conf.d/30-apcu.ini | |
sudo ln -s /etc/php/7.1/mods-available/apcu.ini /etc/php/7.1/cli/conf.d/30-apcu.ini | |
php -v | |
sudo apt install -y imagemagick php-imagick | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
sudo php composer-setup.php --install-dir=/bin --filename=composer | |
php -r "unlink('composer-setup.php');" | |
sudo apt install -y crudini | |
wget "https://gist.github.com/igodorogea/bd739926def35ae6237049db424110ee/raw/4294674527bfcf9f300d16a16d25041978889eae/20-typo3-php.ini" | |
sudo cp /etc/php/7.1/fpm/php.ini /etc/php/7.1/fpm/php.ini.bak | |
sudo crudini --merge --format=ini /etc/php/7.1/fpm/php.ini < 20-typo3-php.ini | |
sudo cp /etc/php/7.1/cli/php.ini /etc/php/7.1/cli/php.ini.bak | |
sudo crudini --merge --format=ini /etc/php/7.1/cli/php.ini < 20-typo3-php.ini | |
wget "https://gist.github.com/igodorogea/bd739926def35ae6237049db424110ee/raw/4294674527bfcf9f300d16a16d25041978889eae/30-typo3-nginx.conf" | |
sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak | |
sudo mv 30-typo3-nginx.conf /etc/nginx/nginx.conf | |
sudo nginx -t | |
sudo service nginx reload | |
sudo service php7.1-fpm restart | |
sudo chown -R www-data:www-data /var/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
wget "https://gist.github.com/igodorogea/bd739926def35ae6237049db424110ee/raw/4294674527bfcf9f300d16a16d25041978889eae/31-typo3-nginx-site.conf" | |
sudo mv typo3-nginx-site.conf /etc/nginx/sites-available/moldovatrade.ivang.xyz.conf | |
sudo ln -s /etc/nginx/sites-available/moldovatrade.ivang.xyz.conf /etc/nginx/sites-enabled/ | |
sudo sed -i 's/server_name www.site.xyz site.xyz;/server_name www.moldovatrade.ivang.xyz moldovatrade.ivang.xyz;/' /etc/nginx/sites-available/moldovatrade.ivang.xyz.conf | |
sudo sed -i 's/root /var/www/site/web;/root /var/www/moldovatrade/web;/' /etc/nginx/sites-available/moldovatrade.ivang.xyz.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[PHP] | |
; Basic configuration override | |
expose_php = Off | |
memory_limit = 256M | |
post_max_size = 20M | |
upload_max_filesize = 20M | |
date.timezone = Europe/Berlin | |
max_execution_time = 240 | |
max_input_vars = 1500 | |
; Error reporting | |
display_errors = stderr | |
display_startup_errors = Off | |
error_reporting = E_ALL | |
; A bit of performance tuning | |
realpath_cache_size = 128k | |
[opcache] | |
; Determines if Zend OPCache is enabled | |
opcache.enable=1 | |
; Determines if Zend OPCache is enabled for the CLI version of PHP | |
opcache.enable_cli=1 | |
; OpCache tuning | |
opcache.max_accelerated_files = 32000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 1; | |
pid /run/nginx.pid; | |
error_log stderr notice; | |
events { | |
multi_accept on; | |
use epoll; | |
worker_connections 1024; | |
} | |
http { | |
# Somehow it's not inherited by vhosts (server{} context) when using with 'stderr' value. | |
# Therefore it's re-defined here to avoid specyfing it for each vhost. | |
error_log stderr notice; | |
## | |
# Basic Settings | |
## | |
server_tokens off; | |
sendfile on; | |
types_hash_max_size 2048; | |
types_hash_bucket_size 64; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 65; | |
keepalive_requests 1000; | |
charset utf-8; | |
fastcgi_read_timeout 240; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
## | |
# SSL Settings | |
## | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE | |
ssl_prefer_server_ciphers on; | |
## | |
# Logging Settings | |
## | |
access_log off; | |
error_log /var/log/nginx/error.log; | |
## | |
# Gzip Settings | |
## | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 4; | |
gzip_min_length 1024; | |
gzip_proxied any; | |
gzip_vary off; | |
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml; | |
gzip_static on; | |
## | |
# Buffers | |
## | |
# Increase buffer size for client requests (incl. file uploads) | |
# so uploading the file up to xMB won't result with Nginx warning: | |
# "a client request body is buffered to a temporary file ..." | |
client_body_buffer_size 5M; | |
# Set max upload size | |
client_max_body_size 256M; | |
# Set directory for storing the temporary files with the body of the request | |
# client_body_temp_path /tmp/nginx/client_temp 1 2; | |
## | |
# Proxy Buffers | |
## | |
# Increase slightly proxy buffer size and amount so it can | |
# handle up to 512KB into the memory (vs. default 32|64kB). | |
# Only used when proxy_pass directive is in place. | |
# proxy_buffer_size 32k; | |
# proxy_buffers 16 32k; | |
# proxy_temp_path /tmp/nginx/proxy_temp 1 2; | |
upstream php-upstream { | |
server unix:/run/php/php7.1-fpm.sock; | |
} | |
include /etc/nginx/sites-enabled/*.conf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name www.site.xyz site.xyz; | |
root /var/www/site/web; | |
index index.php index.html; | |
error_page 404 = @404; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_pass php-upstream; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param DTAP D; | |
fastcgi_param TYPO3_CONTEXT Development; | |
fastcgi_param FLOW_CONTEXT Development; | |
fastcgi_param FLOW_REWRITEURLS 1; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location @404 { | |
rewrite ^ $scheme://$server_name; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
location ~ /\. { | |
deny all; | |
return 404; | |
log_not_found off; | |
} | |
# static content: | |
# - images | |
# - flash | |
# - fonts | |
# - css/js | |
location ~* \.(?:jpe?g|gif|png|ico|swf|svg|eot|ttf|otf|woff2?|htc|css|js)$ { | |
expires max; | |
} | |
location = /favicon.ico { | |
log_not_found off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment