4,461
edits
→Setting up from scratch on a VM at work: Install EPEL repo |
|||
Line 5: | Line 5: | ||
=== Install NGINX === | === Install NGINX === | ||
<source lang=" | <source lang="sh"> | ||
$ sudo yum install yum-utils | $ sudo yum install yum-utils | ||
</source> | </source> | ||
Line 11: | Line 11: | ||
Create <code>/etc/yum.repos.d/nginx.repo</code> | Create <code>/etc/yum.repos.d/nginx.repo</code> | ||
<source lang=" | <source lang="cfg"> | ||
[nginx-stable] | [nginx-stable] | ||
name=nginx stable repo | name=nginx stable repo | ||
Line 31: | Line 31: | ||
Install nginx | Install nginx | ||
<source lang=" | <source lang="sh"> | ||
$ sudo yum install nginx | $ sudo yum install nginx | ||
</source> | |||
Set up folders | |||
<source lang="console"> | |||
# cd /etc/nginx | |||
# mkdir sites-available | |||
# mkdir sites-enabled | |||
</source> | |||
Create a file named <code>sites-available/unm.edu.conf</code> | |||
<source lang="nginx"> | |||
server { | |||
listen 80; | |||
listen [::]:80; | |||
server_name unm.edu *.unm.edu; | |||
return 301 https://$host$request_uri; | |||
} | |||
server { | |||
listen 443 ssl http2; | |||
listen [::]:443 ssl http2; | |||
server_name ~^(?<subdomain>.+)\.unm\.dev$; | |||
if (!-d /srv/www/unm.edu/$subdomain) { | |||
set $subdomain "base"; | |||
} | |||
set $public ""; | |||
if (-d /srv/www/unm.edu/$subdomain/public) { | |||
set $public public; | |||
} | |||
root /srv/www/unm.edu/$subdomain/$public; | |||
index index.php index.html index.htm; | |||
access_log /var/log/nginx/access-wildcard.unm.edu.log; | |||
error_log /var/log/nginx/error-wildcard.unm.edu.log; | |||
include php_80_params.conf; | |||
location / { | |||
try_files $uri $uri/ /index.php?$query_string; | |||
} | |||
ssl_certificate /etc/pki/tls/certs/_wildcard.unm.edu.pem; | |||
ssl_certificate_key /etc/pki/tls/private/_wildcard.unm.edu-key.pem; | |||
include letsencrypt_params.conf; | |||
} | |||
</source> | </source> | ||