Created
November 8, 2022 22:39
-
-
Save ethanpil/03080c85bd55129b8c81ee99e9e06bc3 to your computer and use it in GitHub Desktop.
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
#https://codingwithmanny.medium.com/configure-self-signed-ssl-for-nginx-docker-from-a-scratch-7c2bcd5478c6 | |
apk add nginx | |
mkdir /etc/ssl/private | |
openssl req -x509 -nodes -days 365 -subj "/C=CA/ST=QC/O=Company, Inc./CN=mydomain.com" -addext "subjectAltName=DNS:mydomain.com" -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt; | |
mkdir /srv/www | |
chown -R nginx:nginx /srv/www | |
#Configuring nginx | |
tee /etc/nginx/http.d/default.conf << ENDTEE | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
listen 443 ssl http2 default_server; | |
listen [::]:443 ssl http2 default_server; | |
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; | |
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key; | |
root /srv/www; | |
location / { | |
index index.php index.html index.htm; | |
try_files $uri /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
ENDTEE | |
#Add PHP7 (3.15 php7 is in testing repo) | |
php7 php7-fpm php7-opcache php-apcu php7-gd php7-xmlreader php7-bcmath php7-ctype php7-curl php7-exif php7-iconv php7-intl php7-json php7-mbstring php7-openssl php7-pcntl php7-pdo php7-mysqlnd php7-pdo_mysql php7-pdo_odbc php7-pdo_pgsql php7-pdo_sqlite php7-phar php7-posix php7-session php7-xml php7-xsl php7-zip php7-zlib php7-dom php7-redis php7-sodium php7-xdebug php7-tidy --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing | |
#start the web server when the system is launching | |
rc-update add nginx default | |
rc-update add php-fpm7 | |
rc-service nginx start | |
rc-service php-fpm7 start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment