Update README.md

This commit is contained in:
Jonathan Chan 2021-05-14 23:44:57 -07:00 committed by GitHub
parent 8aa7e004ea
commit 48855dabfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 24 deletions

View File

@ -3,13 +3,13 @@
These NGINX configurations set up HTTP servers at port 80. HTTPS on port 443 should be set up using [certbot](https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/).
## Static web page
The URL [example.ert.space](http://example.ert.space) will point to files in `/srv/www/example.ert.space`.
The URL [example.space](http://example.space) will point to files in `/srv/www/example.space`.
```nginx
server {
listen 80;
listen [::]:80;
root /srv/www/example.ert.space;
server_name example.ert.space;
root /srv/www/example.space;
server_name example.space;
error_page 404 /404.html;
location / {
try_files $uri $uri/ =404;
@ -17,15 +17,31 @@ server {
}
```
## PHP site with HTTP authentication
The URL [example.ert.space](http://example.ert.space) will point to the PHP application at `/srv/www/example.ert.space/index.php`. HTTP authentication done as indicated [here](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/).
## Reverse proxy
The URL [example.space](http://example.space) will point to the local [port 8080](http://localhost:8080).
```nginx
server {
listen 80;
listen [::]:80;
server_name example.ert.space;
client_max_body_size 512M;
server_name example.space;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
```
root /srv/www/example.ert.space;
## PHP site with HTTP authentication
The URL [example.space](http://example.space) will point to the PHP application at `/srv/www/example.space/index.php`. HTTP authentication done as indicated [here](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/).
```nginx
server {
listen 80;
listen [::]:80;
server_name example.space;
root /srv/www/example.space;
index index.html index.php;
# set up HTTP basic authentication
@ -39,7 +55,7 @@ server {
# process PHP requests
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
}
location ~ /\.ht {
@ -47,19 +63,3 @@ server {
}
}
```
## Reverse proxy
The URL [example.ert.space](http://example.ert.space) will point to the local [port 8080](http://localhost:8080).
```nginx
server {
listen 80;
listen [::]:80;
client_max_body_size 512M;
server_name example.ert.space;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
```