This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
web [2021/04/15 02:28] nanodano |
web [2022/03/13 19:17] (current) nanodano |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Web Servers | + | ====== Web ====== |
+ | ====== Servers ====== | ||
- | ===== One-line HTTP servers | + | * [[web_servers: |
+ | * [[web_servers: | ||
+ | * [[web_servers: | ||
+ | * [[web_servers: | ||
- | See [[https:// | ||
- | ===== Apache2 httpd ===== | + | ===== Browsers |
- | Debian instructions: | + | * Epiphany |
+ | * Links | ||
+ | * ELinks | ||
+ | * lynx | ||
+ | * Firefox | ||
+ | * Chromium | ||
- | <code bash> | + | ===== Tools ===== |
- | apt install apache2 php libapache2-mod-php php-pdo-sqlite | + | |
- | # Enable/ | + | * curl |
- | a2enmod userdir | + | * wget |
- | a2dismod userdir | + | * Filezilla |
+ | * ftp | ||
+ | * scp | ||
+ | * netstat | ||
- | # Enable/ | + | ===== Development ===== |
- | a2ensite mysite | + | |
- | a2dissite mysite | + | |
- | </ | + | |
- | The user is '' | + | * HTML/CSS |
- | + | | |
- | ===== Nginx ===== | + | |
- | + | | |
- | See [[https:// | + | |
- | + | | |
- | <code bash> | + | |
- | apt install nginx | + | |
- | </ | + | |
- | + | ||
- | To add PHP, use PHP FPM | + | |
- | + | ||
- | <code bash> | + | |
- | apt install php-fpm | + | |
- | # Control it with something like: | + | |
- | systemctl restart php7.3-fpm | + | |
- | # Config in / | + | |
- | </ | + | |
- | + | ||
- | Then in your vhost file, include the following snippet: | + | |
- | + | ||
- | < | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | include snippets/ | + | |
- | # Find the right socket in /run/php/ | + | |
- | fastcgi_pass unix:/ | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | Here is an example nginx site config: | + | |
- | + | ||
- | <code text example.nginx.conf> | + | |
- | server { | + | |
- | | + | |
- | | + | |
- | #listen 443 ssl; | + | |
- | #listen [::]:443 ssl; | + | |
- | + | ||
- | server_name www.devdungeon.com; | + | |
- | + | ||
- | # | + | |
- | # | + | |
- | # | + | |
- | + | ||
- | # Map a static dir | + | |
- | location / | + | |
- | alias / | + | |
- | } | + | |
- | + | ||
- | # Reverse proxy | + | |
- | location /camserver/ { | + | |
- | proxy_pass http:// | + | |
- | proxy_set_header X-Real-IP $remote_addr; | + | |
- | } | + | |
- | + | ||
- | # List directory contents | + | |
- | location /images { | + | |
- | autoindex on; | + | |
- | # Use local time instead of UTC for di lists | + | |
- | autoindex_localtime on; | + | |
- | alias / | + | |
- | } | + | |
- | + | ||
- | root / | + | |
- | index index.php index.html; | + | |
- | + | ||
- | location / { | + | |
- | try_files $uri $uri/ =404; | + | |
- | } | + | |
- | + | ||
- | location ~ \.php$ { | + | |
- | include snippets/ | + | |
- | # Find right socket in /run/php/ | + | |
- | fastcgi_pass unix:/ | + | |
- | include fastcgi_params; | + | |
- | } | + | |
- | + | ||
- | location ~ /\.ht { | + | |
- | deny all; | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | If you want to redirect HTTP to HTTPS you can use this redirect snippet. Also you can set the acme directory not to redirect so you can use certbot certonly with webroot config. | + | |
- | + | ||
- | <code text redirect.nginx.conf> | + | |
- | # Redirect HTTP traffic to HTTPS (both www and non-www) | + | |
- | server { | + | |
- | listen 0.0.0.0: | + | |
- | listen [::]:80; | + | |
- | + | ||
- | server_name mydomain.com www.mydomain.com; | + | |
- | root / | + | |
- | + | ||
- | # For Certbot challenges | + | |
- | location / | + | |
- | alias / | + | |
- | } | + | |
- | + | ||
- | # Permanent redirect to HTTPS version with www prefix | + | |
- | return 301 https:// | + | |
- | } | + | |
- | </ | + |