Coder Social home page Coder Social logo

serafimpear / lampp-ssh-certbot Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 155 KB

Docker with LAMPP stack and SSH & SFTP access

License: MIT License

Dockerfile 100.00%
docker dockerfile lamp-stack php apache ssh lampp sftp letsencrypt certbot ssl https lamp

lampp-ssh-certbot's Introduction

Simple docker based on Ubuntu 20.04 with LAMPP, SSH & SFTP

Works with Ubuntu 20.04 LTS

This LAMPP stack contains:

  • PHP 7.4.16
  • Apache
  • MariaDB (MySQL)
  • Perl
  • phpMyAdmin

Installation:

  1. Modify Dockerfile and change username and password for SSH
ARG username=user
ARG userpaswd=1234
  1. Build docker:
$ docker build -t serafimpear/lampp-ssh .
  1. And run it (--restart configures the container to always restart unless it is explicitly stopped or Docker is restarted.):
$ docker run -d --restart -p 2222:22 -p 8080:80 --name lampp-ssh serafimpear/lampp-ssh
  1. Once all is ready, there should be this at http://localhost:8080/:

Result

SSH:

$ ssh -p 2222 user@localhost

Web Server:

Location

  • The webserver is located at /opt/lampp
  • Website files /opt/lampp/htdocs

Start, restart & stop

$ sudo /opt/lampp/lampp start
$ sudo /opt/lampp/lampp restart
$ sudo /opt/lampp/lampp stop

Configure:

Apache config

/opt/lampp/etc/httpd.conf

Virtual hosts

/opt/lampp/etc/extra/httpd-vhosts.conf

More you can find at http://localhost/dashboard/faq.html

HTTPS using certbot

Configure Virtual hosts

Before generating a new cerificate, configure httpd-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/opt/lampp/htdocs/"
    ServerName example.com
    ServerAlias www.example.com
    ErrorLog "logs/example.com-error_log"
    CustomLog "logs/example.com-access_log" common
</VirtualHost>

Certbot

If ready, run:

$ sudo certbot --apache-ctl /opt/lampp/bin/apachectl

Enter your email adress:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

Agree with the Terms of Service:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

Enter to select all options:

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: example.com
2: www.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

Certbot will ask you, whether or not to redirect HTTP traffic to HTTPS, I use redirect (2):

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Done!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://example.com and
https://www.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=example.com
https://www.ssllabs.com/ssltest/analyze.html?d=www.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Include new vhosts file

A new file has been created at /opt/lampp/etc/extra/httpd-vhosts-le-ssl.conf, you must include it to httpd.conf:

Manually:

...

Include etc/extra/httpd-vhosts-le-ssl.conf

Or by command

$ printf "\nInclude etc/extra/httpd-vhosts-le-ssl.conf\n" | sudo tee -a /opt/lampp/etc/httpd.conf

Restart LAMPP

Now, restart lampp:

$ sudo /opt/lampp/lampp restart

Congratulations! You just enabled HTTPS on your website!

By using any of the files available in this repository, you understand that you are AGREEING TO USE AT YOUR OWN RISK.

lampp-ssh-certbot's People

Contributors

serafimpear avatar

Stargazers

 avatar  avatar

Watchers

 avatar

lampp-ssh-certbot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.