Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Symfony4 nginx configuration #600

Merged
merged 2 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions resources/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ function serve-symfony2() {
fi
}

function serve-symfony4() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/scripts/serve-symfony4.sh
sudo bash /vagrant/scripts/serve-symfony4.sh "$1" "$2" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-symfony4 domain path"
fi
}

function share() {
if [[ "$1" ]]
then
Expand All @@ -124,7 +137,7 @@ function share() {
echo "Error: missing required parameters."
echo "Usage: "
echo " share domain"
echo "Invocation with extra params passed directly to ngrok"
echo "Invocation with extra params passed directly to ngrok"
echo " share domain -region=eu -subdomain=test1234"
fi
}
Expand All @@ -135,7 +148,7 @@ function flip() {

function __has_pv() {
$(hash pv 2>/dev/null);

return $?
}

Expand Down
13 changes: 13 additions & 0 deletions resources/localized/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ function serve-symfony2() {
fi
}

function serve-symfony4() {
if [[ "$1" && "$2" ]]
then
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/serve-symfony4.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-symfony4.sh "$1" "$2" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-symfony4 domain path"
fi
}

function share() {
if [[ "$1" ]]
then
Expand Down
49 changes: 49 additions & 0 deletions scripts/serve-symfony4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

block="server {
listen ${3:-80};
listen ${4:-443} ssl http2;
server_name $1;
root \"$2\";

index index.html index.htm index.php;

charset utf-8;

location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

access_log off;
error_log /var/log/nginx/$1-ssl-error.log error;

sendfile off;

client_max_body_size 100m;

# DEV
location ~ ^/index\.php(/|\$) {
fastcgi_split_path_info ^(.+\.php)(/.*)\$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;

fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}

location ~ /\.ht {
deny all;
}

ssl_certificate /etc/nginx/ssl/$1.crt;
ssl_certificate_key /etc/nginx/ssl/$1.key;
}
"

echo "$block" > "/etc/nginx/sites-available/$1"
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"