Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Created December 11, 2020 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/d83c56c0ab1c3b744bf7a095070a9dcb to your computer and use it in GitHub Desktop.
Save vpnwall-services/d83c56c0ab1c3b744bf7a095070a9dcb to your computer and use it in GitHub Desktop.
[Nginx VHOST Wordpress Example 2] Nginx VHOST Wordpress Example 2 #nginx #vhost #example
server{
server_name myplatform.local;
listen 80;
# error_log /var/log/nginx/myplatform-error.log;
# access_log /var/log/nginx/myplatform-access.log;
# root /usr/local/nginx/html/myplatform/;
# index index.html;
# location /.well-known/pki-validation/ {
# default_type "text/plain";
# }
return 301 https://myplatform.local;
}
server{
server_name myplatform.local;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
listen 443;
ssl on;
ssl_certificate /etc/ssl/myplatform/2021/myplatform.local.crt;
ssl_certificate_key /etc/ssl/myplatform/2021/myplatform.local.key;
include includes/ssl.conf;
access_log /var/log/nginx/myplatform-access.log;
error_log /var/log/nginx/myplatform-error.log;
root /usr/local/nginx/html/myplatform/prod/;
index index.php index.html;
# rewrite ^/(?:es|it|en|jp|cn|fr|de|ru|pt-br)/vs-cms/(.*) /vs-cms/$1 last;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
# auth_basic "Authorization Required";
# auth_basic_user_file /usr/local/nginx/html/myplatform/.htpasswd;
}
location /wp-admin {
auth_basic "Authorization Required";
auth_basic_user_file /usr/local/nginx/html/myplatform/.htpasswd;
}
location ~ ^.+\.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
try_files $uri =404;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param HTTP_TRUE_CLIENT_IP $remote_addr;
fastcgi_pass unix:/run/php-fpm/www.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment