-
-
Save deanet/5814901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#example vhost protect wp-login.php at nginx php-fpm | |
upstream arraudhah { | |
server unix:/var/run/php5-fpm.sock; | |
} | |
server { | |
listen 80; | |
server_name ar-raudhah.info www.ar-raudhah.info; | |
server_name_in_redirect off; | |
access_log /srv/htdocs/arraudhah/logs/arraudhah.access_log; | |
error_log /srv/htdocs/arraudhah/logs/arraudhah.error_log info; | |
root /srv/htdocs/arraudhah/http/; | |
index index.php index.html index.htm default.html default.htm; | |
location / { | |
##permalinks | |
try_files $uri $uri/ /index.php?q=$uri&$args; | |
} | |
location /unduh { | |
rewrite ^/unduh/([^/]+)$ http://www.ar-raudhah.info/wp-content/plugins/download-monitor/download.php?id=$1 redirect; | |
} | |
location ~* /wp-login.php { | |
auth_basic "Pejuang Ar-Raudhah Area"; | |
auth_basic_user_file /path/passwd; | |
location ~ \.php$ { | |
fastcgi_pass arraudhah; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
} | |
location ~ \.php$ { | |
fastcgi_pass arraudhah; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.modules = ( | |
"mod_access", | |
"mod_alias", | |
"mod_compress", | |
"mod_redirect", | |
"mod_rewrite", | |
"mod_accesslog", | |
"mod_auth" | |
) | |
server.document-root = "/var/www" | |
server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) | |
#### accesslog format (enable for using a proxy, like Pound, in front of Lighttpd) | |
# accesslog.format = "%{X-Forwarded-For}i %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" | |
#### accesslog module | |
accesslog.filename = "/var/log/lighttpd/access.log" | |
server.errorlog = "/var/log/lighttpd/error.log" | |
server.pid-file = "/var/run/lighttpd.pid" | |
server.username = "www-data" | |
server.groupname = "www-data" | |
server.port = 80 | |
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" ) | |
url.access-deny = ( "~", ".inc" ) | |
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) | |
compress.cache-dir = "/var/cache/lighttpd/compress/" | |
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" ) | |
# default listening port for IPv6 falls back to the IPv4 port | |
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port | |
include_shell "/usr/share/lighttpd/create-mime.assign.pl" | |
include_shell "/usr/share/lighttpd/include-conf-enabled.pl" | |
$HTTP["host"] =~ "www.sarkub.com" { | |
url.rewrite-final = ( | |
# Exclude some directories from rewriting | |
"^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0", | |
# Exclude .php files at root from rewriting | |
"^/(.*.php)" => "$0", | |
# Handle permalinks and feeds | |
"^/(.*)$" => "/index.php/$1" | |
) | |
$HTTP["url"] =~ "^\/wp-admin\/.*" { | |
$HTTP["url"] !~ "^\/wp-admin\/(admin-ajax\.php|css\/.*)" { | |
auth.backend = "htpasswd" | |
auth.backend.htpasswd.userfile = "/path/passwd" | |
auth.require = ( | |
"" => ( | |
"method" => "basic", | |
"realm" => "Password protected area", | |
"require" => "valid-user", | |
), | |
), | |
}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment