server {
listen 80 default_server;
location /.well-known {
root /usr/share/nginx/tmp_cert;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl default_server;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
root /usr/share/nginx/localhost;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
include fastcgi_params;
}
}
server {
listen 443 ssl;
server_name sql.example.com;
ssl_certificate /etc/letsencrypt/live/sql.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sql.example.com/privkey.pem;
client_max_body_size 50m;
fastcgi_read_timeout 500s;
root /usr/share/nginx/phpmyadmin;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
include fastcgi_params;
}
}
user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '[$time_local] | $host - "$request" | $remote_addr - $remote_user '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
include /etc/nginx/conf.d/*.conf;
}