Posted in Docker
672
3:47 am, June 16, 2022
 

What's the Point of Docker?

<article id="e9ddc339-dadc-4662-9a5a-22fc2279f6ef" class="page sans"><header>
<h1 class="page-title">What's the Point of Docker?</h1>
</header>
<div class="page-body">
<figure id="31e0cdfe-0a75-4ea4-840e-827b26e23e58">
<div class="bookmark-info">
<div class="bookmark-text">
<div class="bookmark-title alert alert-info">These are my notes on installing docker on a VPS, there a bit jumbled, but mostly a full collection of the commands i used to get docker working with docker config. Also a lot of links to external sources that i got a lot of the config info from.&nbsp;</div>
<h3 class="bookmark-title"><img src="https://i.imgur.com/ElC7jVE.png" /></h3>
<h3 class="bookmark-title">Getting Started With Docker On Your VPS (Tutorial) | Serverwise</h3>
<div class="bookmark-description">Getting started with Docker on your VPS is pretty straightforward, and once you're set up via this Docker tutorial, it's like you've "leveled up" in DevOps. Docker is a platform for designing, building, and launching "containers," which are isolated environments containing all the software and configuration files necessary to run a service or application. <a href="https://blog.ssdnodes.com/blog/getting-started-docker-vps/" target="blank" rel="noopener">Link.</a>&nbsp;</div>
<div class="bookmark-description">&nbsp;</div>
<h3 class="bookmark-description">So what is the point of docker?</h3>
<div class="bookmark-description">
<ul id="9639c12a-e66f-48d0-88b5-346e51c193e7" class="bulleted-list">
<li style="list-style-type: disc;"><strong><span style="color: #b96ad9;">Develop locally</span> </strong>using a custom or specific environment.</li>
</ul>
<ul id="b78fc9b5-be83-4caf-bce4-34e1dd02d902" class="bulleted-list">
<li style="list-style-type: disc;">Make sure that the <strong><span style="color: #2dc26b;">local dev environment</span> </strong>is the same as the live deployed environment.&nbsp;</li>
</ul>
<ul id="edc26ad9-10cc-492a-b9a6-575c3b1d3663" class="bulleted-list">
<li style="list-style-type: disc;"><strong><span style="color: #f1c40f;">Setup docker files</span> </strong>or docker images to make sure your apps have redundancy or fail overs in case of server errors or application errors.&nbsp;</li>
</ul>
<ul id="174d18dc-5184-4f02-8371-01d94a16d9b8" class="bulleted-list">
<li style="list-style-type: disc;"><span style="color: #3598db;"><strong>Run multiple applications</strong></span> on a VPS without them conflicting with each other as they are seperated on the same system.&nbsp;</li>
</ul>
<ul id="bdd0e209-8f31-42ed-87ac-a9c64f4d146e" class="bulleted-list">
<li style="list-style-type: disc;"><span style="color: #b96ad9;"><strong>Stop one crash</strong></span> taking the whole server down, if you have a fault in one container it should not effect other containers on the same machine.&nbsp;</li>
</ul>
<ul id="bf9225d4-d740-4320-aea6-cedd37090051" class="bulleted-list">
<li style="list-style-type: disc;"><span style="color: #2dc26b;"><strong>Dont restart your server</strong> </span>but restart the container, with out effecting other containers on the same server.&nbsp;</li>
</ul>
<ul id="338888d8-e1f1-4c90-8f70-9a6b8c303427" class="bulleted-list">
<li style="list-style-type: disc;"><strong><span style="color: #e67e23;">Better Security</span> </strong>as most containers run specific environments that are rebuilt only using docker so nothing touches the pre built docker systems.&nbsp;</li>
</ul>
</div>
<div class="bookmark-description">&nbsp;</div>
<h3 class="bookmark-description">Prune Images</h3>
<p>Incase your docker images are taking up too much space you can run this</p>
</div>
</div>
</figure>
<p id="d61923e0-a5fc-4004-a8a0-664cb5fdac8a" class=""></p>
<p id="45cd49b6-716b-4081-84cc-f8879d857ff1" class=""></p>
<pre id="47ca096a-5686-41ab-bb06-5c8546199c3a" class="code code-wrap"><code>Prune images
perge images

docker image prune -a</code></pre>
<p id="749b688b-3fa0-4921-872d-5806fdba1145" class=""></p>
<ul id="9639c12a-e66f-48d0-88b5-346e51c193e7" class="bulleted-list"></ul>
<h3>&nbsp;</h3>
<h3>Docker Hub</h3>
<p>Docker Hub allows you to share and save your custom images and load a library of existing images. <a href="https://hub.docker.com/" target="
blank" rel="noopener">Link</a></p>
<p id="19ef2b46-f8f5-4c2f-a071-530a643cd4c1" class=""></p>
<figure id="b4da72ab-775b-4f09-a2b1-4e8e3886dd58">
<div class="bookmark-info">
<div class="bookmark-href">&nbsp;</div>
</div>
</figure>
<h2 id="5b6b8b61-3922-4359-ba97-f526a48d909c" class="">Installing Docker on Ubuntu 16, 18, 20</h2>
<p id="41af1fcf-776f-4065-a360-6a65b60a47ab" class="">ubuntu 18 command line install</p>
<p id="1cfa6227-3748-4b1a-961f-5a2854f41324" class="">guide to installing docker on ubuntu 20</p>
<figure id="4fd3b27a-36f0-4c37-9693-9a1a65e22519">
<div class="bookmark-info">
<div class="bookmark-text">
<h3 class="bookmark-title">How To Install and Use Docker on Ubuntu 20.04&nbsp;</h3>
<div class="bookmark-description">Docker is an application that simplifies the process of managing application processes in containers. Containers let you run your applications in resource-isolated processes. They're similar to virtual machines, but containers are more portable, more resource-friendly, and more dependent on the host operating system. <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04" target="blank" rel="noopener">Link.</a></div>
</div>
</div>
<a class="bookmark source" href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04"><img class="bookmark-image" src="https://www.digitalocean.com/
next/static/media/social-share-default.e8530e9e.jpeg" /></a></figure>
<p id="765bb7e0-d31f-476b-9c00-118a89536952" class=""></p>
<h3 id="c36ef1d5-1292-4ffa-b2f2-83b88cab2e37" class="">Pi 400 Docker</h3>
<p>I tried getting docker up and running also on the pi400 but as its arm based i came across some issues running normal docker containers, assuming this is due to the images being intel or amd based.&nbsp;</p>
<p id="b4ba8703-c2ee-4808-9627-b4fad5025dd9" class=""><strong>Local domain</strong></p>
<pre id="f4578d39-a16c-44bb-a76c-72bbf10649b5" class="code code-wrap"><code>To create a .local domain, install Avahi Daemon on your Pi;

sudo apt-get install avahi-daemon

By default, the hostname is raspberrypi.</code></pre>
<p id="31da49ff-2c87-4f59-9a11-4113ab7573c5" class=""></p>
<figure id="217df811-5825-4b52-b5b6-91452c277bf6">
<div class="bookmark-info">
<div class="bookmark-text">
<h3 class="bookmark-title">Install Docker-Compose on Raspberry Pi - JFrog Connect (formerly Upswift)</h3>
<div class="bookmark-description">Docker containers are light-weight, requires minimal resources and makes it possible to deliver your software quicker, which makes them extremely useful for SBC's such as Raspberry Pi. How do we define and run multi-container docker applications? Docker-Compose is the answer. <a href="https://www.jfrog.com/connect/post/install-docker-compose-on-raspberry-pi/" target="blank" rel="noopener">Link</a>.</div>
<div class="bookmark-description">&nbsp;</div>
</div>
</div>
<a class="bookmark source" href="https://www.jfrog.com/connect/post/install-docker-compose-on-raspberry-pi/"><img class="bookmark-image" src="https://www.jfrog.com/connect/images/611a4af2d841d24ffd4c5332
raspberrypidocker-930x620.jpeg" /></a></figure>
<h3>Install Docker on Rasberry Pi</h3>
<pre id="61638e47-d5cc-471e-980e-1a402e042735" class="code code-wrap"><code>install docker

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

&zwj;sudo usermod -aG docker ${USER}

check if its in the group

groups ${USER}

su the user or logout and back in

test if docker is working

docker version

&zwj;docker info

docker run hello-world

docker image rm hello-world</code></pre>
<p id="e4674b7e-aebc-4f77-880a-624234c8832d" class=""></p>
<h3 id="b6515ada-8a85-4eaf-9f5d-89865a950f36">Docker Compose on pi400</h3>
<pre id="14031984-d99f-4ca7-9f36-497cc6361c43" class="code code-wrap"><code>sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip

&zwj;sudo pip3 install docker-compose

&zwj;sudo systemctl to enable Docker??
</code></pre>
<p id="9d5c2f9c-2e14-4bc0-a823-629255e9172f" class=""></p>
<pre id="830fb0b3-a126-4af4-9f53-b862d1a820e8" class="code code-wrap"><code>sudo apt update

sudo apt install apt-transport-https ca-certificates curl software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

apt-cache policy docker-ce

sudo apt install docker-ce

sudo systemctl status docker</code></pre>
<p id="d30a795c-da5b-4ef1-9265-fd7914f674b0" class=""></p>
<h3 id="9b69b579-c819-4440-b9a1-1beb66bb4b5d">Docker Installing</h3>
<img src="https://i.imgur.com/c1M7RtL.png" />
<p id="f3832400-d159-4b9a-83c5-c35849be0273" class=""></p>
<h3 id="bcbbd6c6-64c6-492c-a8ca-03d411f73afb">Docker Running</h3>
<img src="https://i.imgur.com/E5Zep3K.png" />
<p id="8d808519-bfff-4f4d-bf83-ffe062e24398" class=""></p>
<pre id="561689d4-c4db-4cae-b34c-b05fdc4fa3b4" class="code code-wrap"><code>sudo usermod -aG docker kruxor

sudo usermod -aG docker ${USER}

su - ${USER}

groups

docker info

docker run hello-world</code></pre>
<p id="ed0a59e6-ed7c-43a7-bcae-e9e406e9ffe4" class=""></p>
<pre id="793a142c-081e-44e7-b3ec-4967981a8d18" class="code code-wrap"><code>Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/</code></pre>
<p id="a49fbfe3-231d-446a-8e5a-52c5b0683b3a" class=""></p>
<pre id="6a34cb2a-e7cc-43fd-97bf-ea86bbf6360a" class="code code-wrap"><code>docker search ubuntu</code></pre>
<p id="4352c50d-98b8-4277-9e7e-bbff352185ff" class=""></p>
<img src="https://i.imgur.com/bvL0wT7.png" />
<p id="702a546d-e97c-464b-b104-2e98a68075cd" class=""></p>
<pre id="56aa6372-782a-4848-a27d-8ed2bd726bae" class="code code-wrap"><code>docker pull ubuntu</code></pre>
<img src="https://i.imgur.com/13UGpkI.png" />
<pre id="00d930cb-db7c-4255-a83c-72ec425850ab" class="code code-wrap"><code>show images
docker images
docker run ubuntu</code></pre>
<p id="b34e0ce0-49e9-4df3-81ae-a9ce61434180" class=""></p>
<p id="514397eb-156c-4197-828b-c314a28209ae" class="">run ubuntu image with an interactive shell</p>
<pre id="7aaa7f3a-c020-4736-b6a8-814b77b13a99" class="code code-wrap"><code>docker run -it ubuntu</code></pre>
<p id="d00a3277-8a84-4b2b-bc2d-76ca3a59bb74" class=""></p>
<p id="317a09fb-8e9a-4f95-af8f-e22fe66378ec" class="">install node on this new instance of ubuntu</p>
<p id="97dc6ba6-f7c2-4a96-99c5-de4216251195" class="">copy the instance id as well</p>
<pre id="4bbedb61-2f2a-4ed5-bff8-8bb1ea965589" class="code code-wrap"><code>docker run -it ubuntu

#007f6db6d204

apt update

apt install nodejs

node -v

#Any changes you make inside the container only apply to that container.</code></pre>
<p id="5703d823-48ab-4b19-9bf0-ccc57f2e5ee5" class=""></p>
<pre id="4b331bbc-088f-42b1-a6b2-7ff822342a32" class="code code-wrap"><code>show all containers
docker ps -a
docker ps -l

#start a container by id
docker start 007f6db6d204
docker run -it sleepywiles
docker run -it 007f6db6d204</code></pre>
<p id="b0a25cf6-f954-424b-a721-4a7fbb5dbf08" class=""></p>
<h3 id="8ed366b9-a92d-4c8d-85d2-45b3711aaed1" class="">commit changes to image</h3>
<p id="5a62ca50-2f4c-4d24-b9c3-92972265a600" class="">requires a docker hub user id</p>
<pre id="664e45e4-642e-47b7-92e1-a7d75b1f8a8b" class="code code-wrap"><code>docker commit -m "What you did to the image" -a "Author Name" container
id repository/newimagename

docker commit -m "added Node.js" -a "sammy" d9b100f2f636 sammy/ubuntu-nodejs

</code></pre>
<p id="6c43e5a4-b0d6-4714-8978-f594b349554b" class=""></p>
<p id="f6fa89b4-0ecf-4096-bb5a-10f9ac080785" class="">enable docker auto start on restart of the vm</p>
<pre id="33ac4f71-d2ce-4742-af2d-a601591667de" class="code code-wrap"><code>$ sudo systemctl enable docker</code></pre>
<p id="ae03debf-c053-4b3e-b667-db8d63411c46" class=""></p>
<p id="39003713-cfdf-4361-9b6c-bf0da06e9dd4" class="">install docker compose</p>
<pre id="99554d7c-760d-4d58-ad37-cb01ab159567" class="code code-wrap"><code>apt install docker-compose</code></pre>
<p id="7f1d7b84-ec5e-4815-8399-dd9b48cc37cd" class=""></p>
<p id="231dff51-ebbb-4652-aad7-a5a6207f6c48" class="">get a basic lamp stack running on docker with local php files</p>
<pre id="659578c0-3c4d-45eb-9cb0-9ed51300f6bb" class="code code-wrap"><code>mkdir $HOME/apache &amp;&amp; cd $HOME/apache

printf '&lt;?php phpinfo(); ?&gt;' &gt; info.php

docker run -d --name=apache -p 8085:80 -v $HOME/apache:/var/www/html php:apache

test it.

nerd2.kruxor.com:8085

running but getting error
http://nerd2.kruxor.com:8085/

http://nerd2.kruxor.com:8085/info.php</code></pre>
<img src="https://i.imgur.com/JIWT1op.png" />
<p id="af0374f0-0edc-4915-b75d-ddbc467a5f94" class=""></p>
<p id="730dad01-11be-4bd9-ace0-de146983046e" class="">working on info.php</p>
<img src="https://i.imgur.com/KeyeuI5.png" />
<p id="97396842-40bc-4b93-8d0d-941101437d7f" class=""></p>
<p id="2e0958b7-d57e-4b79-8d7a-9535a86fa01c" class="">stop and delete the image</p>
<pre id="71ab2eb7-7e83-48f9-9736-0df53efcf610" class="code code-wrap"><code>$ docker stop apache
$ docker rm apache
$ docker rmi php:apache</code></pre>
<p id="f21897a5-3645-40d3-9e35-07c117de9260" class=""></p>
<p id="c33e534b-81ed-48e7-b33d-44a86d6e5dcf" class="">install and run wordpress...</p>
<p id="858adea5-ca4a-4c89-a743-2ab99420d60d" class="">this will create a wordpress and mysql containers and wordpress.</p>
<p id="b6a69399-d6c3-4fe5-9990-490194bc1806" class="">do a test install of wordpress and sqlserver... from here:</p>
<p id="903ba231-5668-4921-b739-f567a5b80ecc" class=""><a href="https://blog.ssdnodes.com/blog/getting-started-docker-vps/">https://blog.ssdnodes.com/blog/getting-started-docker-vps/</a></p>
<pre id="dad9ee38-0936-4a07-9dc3-210875d4d9b3" class="code code-wrap"><code>mkdir wptest &amp;&amp; cd wptest

nano docker-compose.yml

version: '2'

services:
db:
image: mysql:5.7
volumes:
- dbdata:/var/lib/mysql
restart: always
environment:
MYSQL
ROOTPASSWORD: password
MYSQL
DATABASE: wordpress
MYSQLUSER: wordpress
MYSQL
PASSWORD: password<br /> &nbsp; &nbsp; &nbsp;containername: wptestdb

wordpress:
dependson:
- db
image: wordpress:latest
ports:
- "8085:80"
restart: always
environment:
WORDPRESS
DBHOST: db:3306
WORDPRESS
DBUSER: wordpress
WORDPRESS
DBPASSWORD:
passwordg
containername: wptest
volumes:
dbdata:

docker-compose up -d

docker ps

test:
http://nerd2.kruxor.com:8085

to save the data and shut down
docker-compose down</code></pre>
<p id="6c8f78bb-1e79-4e0b-90d0-b50c36c31dcd" class="">then need to figure out how to route nginx to the different docker containers, i guess just run them on diff ports like this:</p>
<pre id="80552144-fe1e-4e39-8b08-56ea87a45242" class="code code-wrap"><code>docker run -d --name=apache -p 8085:80 -v $HOME/apache:/var/www/html php:apache</code></pre>
<p id="4f00fe07-bf19-4aab-9690-bc1e39db1ce6" class=""></p>
<p id="4a948f54-ac23-45cf-8462-f26a0cd96aa5" class=""></p>
<figure id="101fa594-652f-46c9-871b-1bd3cd0dc838">
<div class="bookmark-info">
<div class="bookmark-text">
<h3 class="bookmark-title">Hosting multiple SSL-enabled sites with Docker and Nginx</h3>
<div class="bookmark-description">In one of our most popular tutorials- Host multiple websites on one VPS with Docker and Nginx-I covered how you can use the nginx-proxy Docker container to host multiple websites or web apps on a single VPS using different containers. <a href="https://blog.ssdnodes.com/blog/host-multiple-ssl-websites-docker-nginx/" target="
blank" rel="noopener">Link</a>.</div>
</div>
</div>
</figure>
<h3 id="a59f90a2-c795-4cd7-96b7-046a476cc302">nginx proxy</h3>
<pre id="2ee027bc-dbf8-4471-9305-e14b5333b9d9" class="code code-wrap"><code>mkdir nginx-proxy &amp;&amp; cd nginx-proxy

docker network create nginx-proxy

36649645c730d7c433c85af48d3ad52fd16f4e16470c96ea7e6f0e5f1b7fb125

</code></pre>
<p id="30dcc1a3-bf26-4cf6-9553-d20dfaef8d43" class=""></p>
<h3 id="1079f052-ed41-44c3-860b-82d85d2e5ec8">Setup ngix reverse proxy</h3>
<figure id="f633135b-9bbd-4e6a-a2de-11c8e8466bf2">
<div class="bookmark-info">
<div class="bookmark-text">
<h3 class="bookmark-title">Automated Nginx Reverse Proxy for Docker</h3>
<div class="bookmark-description">A reverse proxy server is a server that typically sits in front of other web servers in order to provide additional functionality that the web servers may not provide themselves. For example, a reverse proxy can provide SSL termination, load balancing, request routing, caching, compression or even A/B testing. <a href="http://jasonwilder.com/blog/2014/03/25/automated-nginx-reverse-proxy-for-docker/" target="blank" rel="noopener">Link</a>.</div>
<div class="bookmark-description">&nbsp;</div>
<div class="bookmark-description"><span style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;">https://github.com/nginx-proxy/nginx-proxy</span></div>
</div>
</div>
</figure>
<p id="04b5f308-124e-4812-b5b6-a50a67f51d65" class=""></p>
<p id="b07d1113-10c6-4f5d-bf2d-ee6cd26c98b8" class=""></p>
<h2 id="d3caa704-867b-49aa-8605-e80536676c39" class="">Hosting multiple SSL-enabled sites with Docker and Nginx</h2>
<figure id="82a1570f-f18a-416d-9059-3f37d0e52388">
<div class="bookmark-info">
<div class="bookmark-text">
<div class="bookmark-description">In one of our most popular tutorials- Host multiple websites on one VPS with Docker and Nginx-I covered how you can use the nginx-proxy Docker container to host multiple websites or web apps on a single VPS using different containers. <a href="https://blog.ssdnodes.com/blog/host-multiple-ssl-websites-docker-nginx/" target="
blank" rel="noopener">Link</a>.</div>
<div class="bookmark-description">&nbsp;</div>
</div>
</div>
</figure>
<pre id="86b02187-d6e6-437a-b0a6-2463c4c5c0ad" class="code code-wrap"><code>mkdir nginx-proxy &amp;&amp; cd nginx-proxy

docker network create nginx-proxy

db02b5af510e6e53b8d170705136fa2b8db1dac5a6f4ab3e82e400404a5d95d6

nano docker-compose.yml

version: '3'

services:
nginx:
image: nginx:1.13.1
containername: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
labels:
- "com.github.jrcs.letsencrypt
nginxproxycompanion.nginxproxy=true"

dockergen:
image: jwilder/docker-gen:0.7.3
container
name: nginx-proxy-gen
dependson:
- nginx
command: -notify-sighup nginx-proxy -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro

letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container
name: nginx-proxy-le
dependson:
- nginx
- dockergen
environment:
NGINX
PROXYCONTAINER: nginx-proxy
NGINX
DOCKERGENCONTAINER: nginx-proxy-gen
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro

volumes:
conf:
vhost:
html:
certs:

Do not forget to 'docker network create nginx-proxy' before launch, and to add '--network nginx-proxy' to proxied containers.

networks:
default:
external:
name: nginx-proxy

curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl &gt; nginx.tmpl

docker-compose up -d

docker ps

check logs with (optional)
docker logs</code></pre>
<p id="dc82d6c2-ee80-4777-b810-9ef9997c0f84" class=""></p>
<p id="8a9b8da2-5942-4e5b-a73d-5808d1faece2" class="">Get containers working with the nginx proxy</p>
<p id="04974407-cfc1-4b33-827d-7af358a85af9" class="">add the following to the container settings in docker compose</p>
<p id="145bfbfc-a601-4494-84cd-b968232348b9" class="">test this with a wordpress installation</p>
<pre id="59a73f31-f29b-4c52-8c71-76c61a58eaa8" class="code code-wrap"><code>environment:
VIRTUALHOST: feeds.example.com
LETSENCRYPT
HOST: feeds.example.com
LETSENCRYPTEMAIL: foo@example.com

environment:
VIRTUAL
HOST: wp3.kruxor.com
LETSENCRYPTHOST: wp3.kruxor.com
LETSENCRYPT
EMAIL: email@gmail.com</code></pre>
<pre id="8160e736-6113-4dfb-8c59-32e06e507284" class="code code-wrap"><code>networks:
default:
external:
name: nginx-proxy</code></pre>
<pre id="140fd8d3-0701-4fc7-84ab-fd24621d7e5a" class="code code-wrap"><code>expose:
- 80</code></pre>
<p id="0c469a24-5cf7-42a4-87f3-3a6f1465b4ae" class="">Install wordpress using virtual hosts and ssl</p>
<p id="95624500-94c9-41a5-92e6-9b550b154f42" class=""></p>
<pre id="75005877-cceb-4dd1-9ebb-be74839cc7f0" class="code code-wrap"><code>mkdir $HOME/wp3 &amp;&amp; cd $HOME/wp3

nano docker-compose.yml</code></pre>
<pre id="47e79732-364d-4db1-9b9b-764c1155b322" class="code code-wrap"><code>version: "3"

services:
db
nodedomain:
image: mysql:5.7
volumes:
- db
data:/var/lib/mysql
restart: always
environment:
MYSQLROOTPASSWORD: password
MYSQLDATABASE: wordpress
MYSQL
USER: wordpress
MYSQLPASSWORD: password
container
name: wptestdb

wordpress:
dependson:
- db
nodedomain
image: wordpress:latest
expose:
- 80
restart: always
environment:
VIRTUAL
HOST: wp3.kruxor.com
LETSENCRYPTHOST: wp3.kruxor.com
LETSENCRYPT
EMAIL: email@gmail.com
WORDPRESSDBHOST: dbnodedomain:3306
WORDPRESSDBUSER: wordpress
WORDPRESSDBPASSWORD: password
containername: wptest
volumes:
dbdata:

networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="c85f5803-6350-47f8-bde5-b717c35d5292" class=""></p>
<pre id="9b70cfd9-8938-4156-afa7-b8032d9f3189" class="code code-wrap"><code>docker-compose up -d</code></pre>
<p id="dd246721-74ca-42ca-ab72-a24a1bb53de5" class=""></p>
<h3 id="1f609f4f-fd23-4f93-be34-914d69a87bad" class="">Custom Container for Core, PHP and SQLite, Nginx</h3>
<figure id="851da4d8-3b5d-426e-be00-d5d2a614193c">
<div class="bookmark-info">
<div class="bookmark-text">
<div class="bookmark-title"><strong>Get started with Docker Compose</strong></div>
<div class="bookmark-description">Estimated reading time: 11 minutes On this page you build a simple Python web application running on Docker Compose. The application uses the Flask framework and maintains a hit counter in Redis. While the sample uses Python, the concepts demonstrated here should be understandable even if you're not familiar with it. <a href="https://docs.docker.com/compose/gettingstarted/" target="
blank" rel="noopener">Link</a>.&nbsp;</div>
</div>
</div>
</figure>
<pre id="dc7aee92-269a-4663-ab4e-cd50b6d413e7" class="code code-wrap"><code>https://docs.docker.com/compose/gettingstarted/
</code></pre>
<p id="23f4b751-478a-4b85-a5d1-b14e3aba4d2c" class=""></p>
<p id="a2864421-0026-45b9-a63a-ee787caa3a5a" class="">copy core files to git private and</p>
<p id="a840ca24-180c-4e60-ab94-b17b1b61fbf8" class="">or just zip them up and then download with curl or wget</p>
<p id="ccf47561-61dd-4ce1-afd2-85f41fdcc5de" class=""></p>
<p id="6a250632-3faa-4093-9995-27b525c32181" class="">leave the git part for another time</p>
<p id="111a179c-c951-4757-970c-9962a9ce9608" class="">copy kruxor.com</p>
<p id="a3f41fcd-c964-4b3b-bb47-a417bdca64b6" class=""></p>
<h3 id="c0e2989d-5262-4c2d-b2f5-6477f846b801">tar gz something</h3>
<pre id="c5a86193-e63b-419d-857a-0494705cba46" class="code code-wrap"><code>tar -czvf ~/backup/$1.tar.gz /var/www/html/$1/

tar -czvf ~/kruxor.tar.gz /var/www/html/kruxor.com/

wget https://kruxor.com/kruxorbackupmay2022.tar.gz</code></pre>
<p id="0a1cc1cc-aec7-43ca-aaef-83779c97f3e3" class=""></p>
<h3 id="81014a8c-0b36-4f3a-a7d0-812f10e4b0ce">un tar gz something</h3>
<pre id="8a1dd3bf-8ebe-4341-8163-626494c5a18b" class="code code-wrap"><code>tar -xf kruxor
backupmay2022.tar.gz</code></pre>
<p id="d15ddb43-4996-4678-a061-c9e66e21768b" class=""></p>
<p id="5d3d7226-8643-459d-b17a-7841004419eb" class="">docker compose for php fpm and nginx running core on proxy</p>
<pre id="014c63d9-a756-45e3-9a8e-8769dca0af8f" class="code code-wrap"><code>version: "3"
services:
nginx:
build:
context: .
dockerfile: nginx/Dockerfile
ports:
- "8080:80"
networks:
- internal
volumes:
- ./core/:/var/www/html/
- /logs/nginx:/var/log/nginx/
php:
image: php:fpm-alpine
networks:
- internal
volumes:
- ./data/:/var/www/html
networks:
internal:
driver: bridge</code></pre>
<p id="5fccf6eb-4330-4bc2-a03c-cbbd5f40a752" class=""></p>
<p id="c138c7d4-29ed-4baf-a5e1-982964cdfe59" class="">i dont think you need nginx as well as its already running as a proxy image</p>
<p id="fc53c757-560c-42fc-ab37-7aca5542dcbb" class="">this one should work once the virtual and lets encrypt hosts are set.</p>
<p id="b9ecd6bc-f1cd-4ef6-aafd-eced9fd1517e" class=""></p>
<h3 id="07c27441-ad50-40d5-a5c4-b289a861977f">format yaml here</h3>
<figure id="004c0fcb-5e2b-46b5-acd3-b12b95bad82f">
<div class="bookmark-info">
<div class="bookmark-text">
<h3 class="bookmark-title">Best YAML Formatter Online: Advance YAML Formatter</h3>
<div class="bookmark-description">Online YAML Formatter will format yaml data, and helps to validate, convert YAML to JSON. Save and Share YAML. <a href="https://jsonformatter.org/yaml-formatter" target="blank" rel="noopener">Link</a>.&nbsp;</div>
</div>
</div>
</figure>
<pre id="a48c5b8f-dee9-46fa-8cd1-9a76a6125afa" class="code code-wrap"><code>nano docker-compose.yml</code></pre>
<pre id="c72f2cce-dceb-4162-80e5-3b608da7ef66" class="code code-wrap"><code>version: "3"

services:
nginx:
build:
context: .
dockerfile: nginx/Dockerfile
ports:
- "8080:80"
volumes:
- ./core/:/var/www/html/
- /logs/nginx:/var/log/nginx/
php:
image: php:fpm-alpine
volumes:
- ./core/:/var/www/html
expose:
- 80
restart: always
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL: email@gmail.com
container
name: corekruxor
networks:
default:
external:
name: nginx-proxy</code></pre>
<pre id="a3c64e59-8e12-4843-a5ab-3ba1dc75846b" class="code code-wrap"><code>docker-compose up -d
test on nerd3.kruxor.com
docker-compose down</code></pre>
<p id="164d43b2-f429-48dc-af8e-15061ad76da1" class=""></p>
<p id="7ea95dea-1cde-40ae-8b42-f3920860b7ab" class="">try php only with route via nginx proxy - this works with ssl, but gives error</p>
<pre id="75192c54-2028-456f-b599-495389147658" class="code code-wrap"><code>version: "3"

services:
php:
image: php:fpm-alpine
volumes:
- ./core/:/var/www/html
expose:
- 80
restart: always
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL: email@gmail.com
containername: corekruxor
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="0f92052c-fa7a-434a-8b56-fad0b5129210" class=""></p>
<p id="ce481baa-0794-4c39-bb57-157a42108f08" class="">example config for nginx and php only</p>
<pre id="9539f6b1-6047-4c8d-9543-46297ee299a0" class="code code-wrap"><code>version: "3"
services:
nginx:
build:
context: .
dockerfile: nginx/Dockerfile
ports:
- "8080:80"
networks:
- internal
volumes:
- ./data/:/var/www/html/
- /logs/nginx:/var/log/nginx/
php:
image: php:fpm-alpine
networks:
- internal
volumes:
- ./data/:/var/www/html
networks:
internal:
driver: bridge
external:
name: nginx-proxy</code></pre>
<p id="ffe0d7df-8e00-45d6-af27-4b9e8b4d62b4" class=""></p>
<p id="c8d65171-c7c5-443e-88d8-a774816611b9" class="">wordpress config as example</p>
<pre id="f9fca6a4-cdfe-4a19-801a-5220c4e032dc" class="code code-wrap"><code>version: "3"

services:
wordpress:
dependson:
- db
nodedomain
image: wordpress:latest
expose:
- 80
restart: always
environment:
VIRTUAL
HOST: wp3.kruxor.com
LETSENCRYPTHOST: wp3.kruxor.com
LETSENCRYPT
EMAIL: email@gmail.com
WORDPRESSDBHOST: dbnodedomain:3306
WORDPRESSDBUSER: wordpress
WORDPRESSDBPASSWORD: password
container
name: wptest
volumes:
db
data:

networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="da390277-98e4-4796-bc7c-949b6d299050" class=""></p>
<p id="23748ec0-522a-4bab-858f-c87249f7676c" class="">copy wp profile for kruxor.com</p>
<pre id="d13e38e1-cfea-457b-b145-47675bf656fc" class="code code-wrap"><code>version: "3"

services:
dbnodedomain:
image: mysql:5.7
volumes:
- dbdata:/var/lib/mysql
restart: always
environment:
MYSQL
ROOTPASSWORD:
password
MYSQL
DATABASE: wordpress
MYSQLUSER: wordpress
MYSQL
PASSWORD:
password
containername: wptestdb

wordpress:
depends
on:
- dbnodedomain
image: wordpress:latest
expose:
- 80
restart: always
environment:
VIRTUALHOST: wp3.kruxor.com
LETSENCRYPT
HOST: wp3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
WORDPRESS
DBHOST: dbnodedomain:3306
WORDPRESS
DBUSER: wordpress
WORDPRESS
DBPASSWORD:
password
container
name: wptest
volumes:
db
data:

networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="c97eb233-119d-486c-b43b-1cf0719c504a" class=""></p>
<p id="04d8f168-13ee-4588-89cf-66ae64023d5d" class="">Next try</p>
<figure id="28f478d8-de77-4e8f-9fd3-cfd783449f60">
<div class="bookmark-info">
<div class="bookmark-text">
<h3 class="bookmark-title">Dockerise your PHP application with Nginx and PHP7-FPM</h3>
<div class="bookmark-description">Before we start, we have to agree on one thing - Docker is super cool! If you are not familiar with Docker, I suggest to have a look at the tons of "Getting starting with Docker" or "What is Docker?" articles and then come back here.</div>
</div>
<div class="bookmark-href">http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/</div>
</div>
<a class="bookmark source" href="http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/"><img class="bookmark-image" src="http://images.geekyplatypus.com/2016/12/18163627/dockerphp.png" /></a></figure>
<pre id="2e6feb90-59df-46bd-b853-774c037a68f7" class="code code-wrap"><code>version: "3"

services:
php:
image: php:fpm-alpine
volumes:
- ./core/:/var/www/html
expose:
- 80
restart: always
environment:
VIRTUALHOST: nerd3.kruxor.com
LETSENCRYPT
HOST: nerd3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
container
name: corekruxor
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="277bde4f-e609-47e5-8f6d-3186b64f6c3c" class=""></p>
<p id="d3b469a0-8cda-44d8-b5ce-bd2b42a60571" class="">just nginx</p>
<pre id="c875d7ea-c3d3-444e-8d8e-576ade4e4167" class="code code-wrap"><code>web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./core:/core
- ./site.conf:/etc/nginx/conf.d/site.conf</code></pre>
<p id="3870ffa1-4677-4f91-977b-8e8663ba9611" class=""></p>
<p id="26e8dcb2-bb65-4ce9-aac7-936814cce0ed" class="">site.conf</p>
<pre id="78aec239-d17d-4840-ac81-63faab788a4b" class="code code-wrap"><code>server {
root /core;
server
name php-docker.local;
errorlog /var/log/nginx/error.log;
access
log /var/log/nginx/access.log;
location / {
index index.php;
tryfiles $uri $uri/ @core;
expires max;
fastcgi
splitpathinfo ^(.+\.php)(/.+)$;
fastcgipass php:9000;
fastcgi
index index.php;
include fastcgiparams;
fastcgi
param SCRIPTFILENAME $documentroot$fastcgiscriptname;
fastcgiparam PATHINFO $fastcgipathinfo;
}
location @core {
rewrite ^/(.)$ /index.php?p=$1;
}
}</code></pre>
<p id="c581abcb-7f29-43e0-aac1-f4bc7401da1d" class=""></p>
<p id="1f222862-ccf4-4b35-99b2-3d66b92f5899" class="">working???...</p>
<p id="9e7ba709-909b-43a8-8df4-cd801870b56f" class="">502 error bad gateway</p>
<pre id="631cbc6e-ad9c-419d-a694-dc7d3a1a95dd" class="code code-wrap"><code>version: "3"

services:
web:
image: nginx:latest
ports:
- "8080:80"
expose:
- 80
volumes:
- ./core:/core
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
containername: nginxkruxor
php:
image: php:7-fpm
expose:
- 80
restart: always
volumes:
- ./core:/core
environment:
VIRTUALHOST: nerd3.kruxor.com
LETSENCRYPT
HOST: nerd3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
container
name: phpfpmkruxor
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="8ce15454-f138-4f47-93d0-de09a63ef9de" class=""></p>
<p id="b48229c4-743b-45bc-9cde-db409e15c236" class="">try server conf with no rewrite</p>
<pre id="0406ff77-067d-4f10-a120-c6f9f1ec1023" class="code code-wrap"><code>server {
index index.php index.html;
server
name php-docker.local;
errorlog /var/log/nginx/error.log;
access
log /var/log/nginx/access.log;
root /core;

location ~ \.php$ {
tryfiles $uri =404;
fastcgi
splitpathinfo ^(.+\.php)(/.+)$;
fastcgipass php:9000;
fastcgi
index index.php;
include fastcgiparams;
fastcgi
param SCRIPTFILENAME $documentroot$fastcgiscriptname;
fastcgiparam PATHINFO $fastcgipathinfo;
}
}</code></pre>
<p id="a34e0684-211a-49a2-bf58-ca5e60d30d1d" class=""></p>
<p id="7a15b5c5-897d-456b-97fc-0455d5305914" class="">copy the wordpress one and remove mysql and replace wordpress with php</p>
<pre id="f27fbeb0-e455-42fa-85cd-7f4cf81acd14" class="code code-wrap"><code>version: "3"

services:
php:
dependson:
- db
nodedomain
image: php:latest
expose:
- 80
restart: always
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL:
email@gmail.com
containername: phpcore
volumes:
dbdata:

networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="4cc3b439-a6f8-46bd-b8ad-fb2257a2af3c" class=""></p>
<p id="b846494f-ed51-4267-8b09-be1900972112" class="">nginx solo</p>
<p id="d5e53ac2-75d2-4fe4-a964-aed4fbc8bdcf" class=""><strong>working nginx only, this works with cert</strong></p>
<pre id="6d218494-1e7a-4e57-926b-1ef4e92fa091" class="code code-wrap"><code>version: "3"

services:
web:
image: nginx:latest
ports:
- "8080:80"
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL:
email@gmail.com
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="ea90621b-3944-4f02-a976-94f6dd02a6fb" class=""></p>
<p id="f8c2ebe8-0af5-4453-94e6-d138ed7b79a8" class="">try the php fpm on as well</p>
<p id="fa87428a-f055-4742-ade6-2135185e4894" class="">moved the envionment to web rather than php</p>
<pre id="cc08d257-e4ab-40ab-b507-7055faeacc82" class="code code-wrap"><code>version: "3"

services:
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./core:/core
- ./site.conf:/etc/nginx/conf.d/site.conf
environment:
VIRTUALHOST: nerd3.kruxor.com
LETSENCRYPT
HOST: nerd3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
links:
- php
container
name: nginxkruxor
php:
image: php:8-fpm
expose:
- 80
restart: always
volumes:
- ./core:/core
container
name: phpfpmkruxor
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="ff1cc471-b53d-4b28-a57e-d4e9f107e5c4" class=""></p>
<p id="a25e6853-c84b-49c1-abfb-bd6a13624b5a" class="">default.conf &mdash; site.conf</p>
<pre id="eaf72593-2665-4de6-b181-0479797a0d7f" class="code code-wrap"><code>server {
index index.php index.html;
server
name phpfpm.local;
errorlog /var/log/nginx/error.log;
access
log /var/log/nginx/access.log;
root /core;
location ~ \.php$ {
tryfiles $uri =404;
fastcgi
splitpathinfo ^(.+\.php)(/.+)$;
fastcgipass php-fpm:9000;
fastcgi
index index.php;
include fastcgiparams;
fastcgi
param SCRIPTFILENAME $documentroot$fastcgiscriptname;
fastcgiparam PATHINFO $fastcgipathinfo;
}
}</code></pre>
<p id="25f122b5-5713-48b6-b309-795ae96f31f7" class=""></p>
<h3 id="f419cfd9-52db-478d-bdbc-247c5d353417">Dockerise web server</h3>
<figure id="892c0c62-554b-4c62-9858-f18fbcbdd881">
<div class="bookmark-info">
<div class="bookmark-text">
<div class="bookmark-title">Dockerize your PHP application with Nginx and PHP8-FPM - marc.it digitale L&ouml;sungen</div>
<div class="bookmark-description">How do I build a small web server with Nginx and PHP8 FPM using Docker Compose? If you are not yet familiar with Docker, I recommend you take a look at the tons of "What is Docker?" and "Getting Started with Docker" articles and tutorials, and then read this post. <a href="https://marcit.eu/en/2021/04/28/dockerize-webserver-nginx-php8/" target="blank" rel="noopener">Link</a>.&nbsp;</div>
</div>
<div class="bookmark-href">&nbsp;</div>
<h3 class="bookmark-href">PHP FPM Solo with Cert</h3>
</div>
</figure>
<pre id="68a38659-da7d-42e6-aac7-d61dd9bf46b6" class="code code-wrap"><code>version: "3"

services:
web:
image: nginx:latest
ports:
- "8080:80"
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL:
email@gmail.com
volumes:
- ./src:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
links:
- php-fpm
php-fpm:
image: php:8-fpm
environment:
VIRTUALHOST: nerd3.kruxor.com
LETSENCRYPT
HOST: nerd3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
volumes:
- ./src:/var/www/html
links:
- web</code></pre>
<p id="1a433956-de1f-4718-8cfd-d2492b285564" class=""></p>
<p id="481aa2cc-ea68-4ccd-a7c7-24e820af075f" class="">try php fpm solo?</p>
<p id="39453d19-f488-4adc-a1e8-430b591bbb10" class=""><strong><mark class="highlight-teal">working!!!!WER@#$%#$%@$T</mark></strong></p>
<p id="f9425a47-e8bd-484c-997c-94d4f5d7f9de" class="">working version in ~/phpfpm via proxy with ssl</p>
<pre id="bc021fac-f9f8-4b08-8466-180abd486977" class="code code-wrap"><code>version: "3"

services:
web:
image: nginx:latest
ports:
- "8080:80"
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL:
email@gmail.com
volumes:
- ./src:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
links:
- php-fpm
php-fpm:
image: php:8-fpm
environment:
VIRTUALHOST: nerd3.kruxor.com
LETSENCRYPT
HOST: nerd3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
volumes:
- ./src:/var/www/html
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="5557a575-526c-4b7b-9706-60b0d20320d4" class=""></p>
<figure id="9ca3de2f-dfd2-43dc-9052-0e7f3341ec2a" class="image"><a href="https://i.imgur.com/xxuO2AN.png"><img src="https://i.imgur.com/xxuO2AN.png" /></a>
<figcaption><a href="https://i.imgur.com/xxuO2AN.png">https://i.imgur.com/xxuO2AN.png</a></figcaption>
</figure>
<p id="a04cd961-09e4-4863-b628-7390ad6636ef" class=""></p>
<p id="01632242-1f1c-4775-9008-f9eeb3a859c8" class="">default.conf</p>
<pre id="7f043aa0-9e30-4cb0-ae1a-f73e81152301" class="code code-wrap"><code>server {
index index.php index.html;
server
name phpfpm.local;
errorlog /var/log/nginx/error.log;
access
log /var/log/nginx/access.log;
root /var/www/html;
location ~ \.php$ {
tryfiles $uri =404;
fastcgi
splitpathinfo ^(.+\.php)(/.+)$;
fastcgipass php-fpm:9000;
fastcgi
index index.php;
include fastcgiparams;
fastcgi
param SCRIPTFILENAME $documentroot$fastcgiscriptname;
fastcgiparam PATHINFO $fastcgipathinfo;
}
}</code></pre>
<p id="4f0b09fc-011e-450d-934c-7c8a76397ad3" class=""></p>
<p id="459e7456-3186-48a4-9535-ce8b1cb2a76d" class="">copy this to core and test on kruxor com</p>
<p id="f7ceb29b-a217-4239-b347-7672a2c91c69" class="">new default.conf with rewrite</p>
<p id="51c5de61-0d21-4129-b443-dd0ff5deb569" class="">/code</p>
<pre id="0ac00382-7256-4668-bc78-c1503ca8dc98" class="code code-wrap"><code>server {
index index.php index.html;
servername phpfpm.local;
error
log /var/log/nginx/error.log;
accesslog /var/log/nginx/access.log;
root /var/www/html;
location ~ \.php$ {
#try
files $uri =404;
tryfiles $uri $uri/ @core;
fastcgi
splitpathinfo ^(.+\.php)(/.+)$;
fastcgipass php-fpm:9000;
fastcgi
index index.php;
include fastcgiparams;
fastcgi
param SCRIPTFILENAME $documentroot$fastcgiscriptname;
fastcgiparam PATHINFO $fastcgipathinfo;
}
location @core {
rewrite ^/(.
)$ /index.php?p=$1;
}
}</code></pre>
<p id="7a66c801-d05c-4687-83e2-3fe4759c0aec" class=""></p>
<p id="fffc0146-58bf-4178-a127-e2fe5d2736b8" class="">new <a href="http://kruxor.com">kruxor.com</a> version for core</p>
<pre id="5f204d94-7164-4f95-9c73-701a54e6a096" class="code code-wrap"><code>version: "3"

services:
web:
image: nginx:latest
ports:
- "8080:80"
environment:
VIRTUALHOST: nerd3.kruxor.com
LETSENCRYPT
HOST: nerd3.kruxor.com
LETSENCRYPTEMAIL:
email@gmail.com
volumes:
- ./core:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
links:
- php-fpm
php-fpm:
image: php:8-fpm
environment:
VIRTUAL
HOST: nerd3.kruxor.com
LETSENCRYPTHOST: nerd3.kruxor.com
LETSENCRYPT
EMAIL:
email_@gmail.com
volumes:
- ./core:/var/www/html
networks:
default:
external:
name: nginx-proxy</code></pre>
<p id="c2b3f8fb-e411-43ae-be78-821eb2ffd172" class=""></p>
<p id="95e27eae-f10d-4936-90f0-fb51a0b946ff" class="">working, but the rewrite is not working in the default.conf, but otherwise its working ok.</p>
<pre id="fddf32d1-5692-4687-9f2b-e052499ce22f" class="code code-wrap"><code>core conf

//
server {
root /var/www/html/nerd3.kruxor.com;
server
name nerd3.kruxor.com;
location / {
index index.php;
tryfiles $uri $uri/ @core;
expires max;
}
location @core {
rewrite ^/(.)$ /index.php?p=$1;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi
pass unix:/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
/
/</code></pre>
<p id="de0f506c-372a-4558-b2d7-7791a8ff48ad" class=""></p>
<p id="4c60c744-c6fd-400f-beb2-7d6104c92ca2" class="">new default.conf</p>
<pre id="159c2df9-dff1-4d2f-bde9-28dea6eddd55" class="code code-wrap"><code>server {
servername phpfpm.local;
error
log /var/log/nginx/error.log;
accesslog /var/log/nginx/access.log;
root /var/www/html;
location / {
index index.php;
try
files $uri $uri/ @core;
expires max;
}
location @core {
rewrite ^/(.
)$ /index.php?p=$1;
}
location ~ \.php$ {
#tryfiles $uri =404;
#try
files $uri $uri/ @core;
fastcgisplitpathinfo ^(.+\.php)(/.+)$;
fastcgi
pass php-fpm:9000;
fastcgiindex index.php;
include fastcgi
params;
fastcgiparam SCRIPTFILENAME $documentroot$fastcgiscriptname;
fastcgi
param PATHINFO $fastcgipath_info;
}
}</code></pre>
</div>
</article>

View Statistics
This Week
207
This Month
925
This Year
785

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in Docker
Search Articles
Search Articles by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote

Really microsoft?


Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.