I have installed Wordpress at the /var/www/html/wordpress and modified my sites-available file as shows:
server {
server_name innerhealerchiropractic.com www.innerhealerchiropractic.com;
root /var/www/html/;
index index.php index.html;
access_log /var/log/nginx/innerhealerchiropractic.com-access.log;
error_log /var/log/nginx/innerhealerchiropractic.com-error.log;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
<^>location /blog/ {
alias /var/www/html/wordpress;
index index.php index.html index.htm index.nginx-debian.html;
try_files $uri $uri/ /blog/index.php$is_args$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
<^>
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
location ~ \.php {
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
## other lines below unchanged as they are for certbot
I am getting a 403 forbidden error when going to https://innerhealerchiropractic.com/blog, and it shows in the access logs that way.
The main site is running yii, so I’m not sure what else I need to do to allow this access. Normally I’d allow my IP access in an .htaccess file but I don’t know how to set that up for this situation.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
To use .htaccess files you will need a create a .htpasswd file outside of the root directory for it to point to.
Assuming you have a server running Apache 2.4, you can create a .htaccess file like this one below. The example below will password protect the info.php file in the root directory and will require both a password and a device originating from the dynamic DNS (underlying IP address). However, you change the DDNS for an IP instead.
DDNS (Dynamic DNS) maps your public IP address from your home ISP broadband to a domain name so that you don’t have to keep typing IP addresses in all the time, and instead use an easily remember-able name. https://www.duckdns.org/ is my free favourite one.
var/www/html/example.com/.htaccess
<Files info.php>
AuthType Basic
AuthBasicProvider file
AuthName "Authentication Required"
AuthUserFile "/etc/apache2/.htpasswd_store/.htpasswd"
<RequireAll>
Require forward-dns my_custom_ddns@duckdns.org
Require valid-user
Require ip 123.123.245.245
</RequireAll>
</Files>
You can create the .htpasswd file with
sudo htpasswd -b /etc/apache2/.htpasswd_store/.htpasswd username password
You will need to add the AllowOverride parameter in Apache’s virtulhost section too so that it looks for `.htaccess files.
<Directory />
DirectoryIndex index.html index.php
AllowOverride All
</Directory>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.