69 lines
1.9 KiB
Text
69 lines
1.9 KiB
Text
### No need to enable the following in wp-config.php
|
|
# define('FORCE_SSL_ADMIN', true);
|
|
# define('FORCE_SSL_LOGIN', true);
|
|
|
|
server {
|
|
listen 80;
|
|
server_name example.com;
|
|
index index.php;
|
|
|
|
# Replace the path with the actual path to WordPress core files
|
|
root /home/username/sites/example.com/public;
|
|
|
|
include globals/assets.conf;
|
|
include globals/restrictions.conf;
|
|
|
|
location ~ \.php$ {
|
|
# Request to wp-login to go through HTTPS protocol
|
|
location ~ /wp-login\.php {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
# Process other requests
|
|
include "fastcgi.conf";
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
try_files $uri =404;
|
|
fastcgi_index index.php;
|
|
fastcgi_pass fpm;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php$is_args$args;
|
|
}
|
|
|
|
}
|
|
server {
|
|
listen 443 ssl;
|
|
server_name example.com;
|
|
index index.php;
|
|
|
|
# Replace the path with the actual path to WordPress core files
|
|
root /home/username/sites/example.com/public;
|
|
|
|
# Generate Certificates
|
|
# http://wiki.nginx.org/HttpSslModule#Generate_Certificates
|
|
ssl_certificate /path/to/combined.crt;
|
|
ssl_certificate_key /path/to/server.key;
|
|
|
|
access_log /var/log/nginx/example.com-access.log combined buffer=64k flush=5m if=$loggable;
|
|
error_log /var/log/nginx/example.com-error.log;
|
|
|
|
include globals/assets.conf;
|
|
include globals/restrictions.conf;
|
|
|
|
location ~ /wp-login\.php$ {
|
|
try_files $uri =404;
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
|
|
include "fastcgi.conf";
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_index index.php;
|
|
fastcgi_pass fpm;
|
|
}
|
|
|
|
# The rewrite magic
|
|
location / {
|
|
try_files $uri $uri/ /index.php$is_args$args;
|
|
}
|
|
|
|
}
|