Hot answers tagged

7 votes
Accepted

Asset URLs not HTTPS

Yii will check for the following server environment variables when determining if it’s an SSL request: HTTPS – should be set to “on”, “ON”, or “1”; or HTTP_X_FORWARDED_PROTO – should be set to “https”...
Brandon Kelly's user avatar
5 votes

Unable to manage robots.txt in Craft

You can simply create a 'robots.txt' file in your templates folder and populate it using twig (templates do not need to end in .twig). Not sure what you're trying to control exactly, but something ...
Douglas McDonald's user avatar
5 votes

Non-default web port

For HTTP the default port is 80 and for HTTPS it's 443, obviously. If port is omitted in the site URL, then the default one is used. If you want to use a different port, you must specify a different ...
Andris Sevcenko's user avatar
5 votes
Accepted

After upgrading to PHP 7 I started getting "storage folder isn't writable by PHP" errors

Try resetting the permissions of the storage folder: https://craftcms.com/docs/installing#step-2-set-the-permissions (It's possible that PHP was running with higher-than-default permissions in the ...
Michael Rog's user avatar
  • 3,400
4 votes

Trailing slashes with Nginx and Craft

After some digging, there appear to be two ways that avoid hitting the admin and url query strings. The first, (and apparently better one, as 'if is evil' according to nginx) uses location handlers: ...
hisnameisjimmy's user avatar
4 votes
Accepted

Static page caching using Nginx FastCGI Cache with CraftCMS

The issue had something to do with PATH_INFO. Adding 'usePathInfo => true' in general.php fixed the issue. Here's the detailed explanation from Craft docs: https://craftcms.com/support/enable-path-...
Anya Dit's user avatar
  • 356
4 votes

Can I use an IP address instead of a FQDN?

First, I can positively confirm I have Craft running on two not hosted, local servers - one a Ubuntu 14.04 (well, Mint) installation, and one a Windows box using Uniserver. Not sure quite what you're ...
Jeremy Daalder's user avatar
4 votes

Trailing slashes with Nginx and Craft

Nginx-Craft has an example setup that does this: https://github.com/nystudio107/nginx-craft/blob/master/sites-available/somedomain.com.conf#L60 # 301 Redirect URLs with trailing /'s as per https://...
andrew.welch's user avatar
  • 11.4k
3 votes

Non-default web port

I'm not sure why you believe this is sub-optimal? You only have to set this once. I'm speculating here but since Craft makes no assumptions about your content, it stands to reason that it also makes ...
RitterKnight's user avatar
  • 6,582
3 votes
Accepted

Unable to manage robots.txt in Craft

It turns out this is an nginx problem. This post describes it: The troubling part of the nginx configuration looks like this location = /robots.txt { access_log off; log_not_found ...
Marion Newlevant's user avatar
3 votes

Barebones LEMP + Craft CMS walkthrough

Here is one: https://medium.com/good-dog/deploying-craft-cms-to-amazon-ec2-running-the-lemp-stack-using-mina-e2ad955138fa#.54s4y29co Disclaimer: I work for the company that published this.
chrisgooley's user avatar
3 votes
Accepted

400 Bad Request on account or admin login

Add this to your nginx server block: server { ... large_client_header_buffers 4 16k; ... } and restart nginx. The default is 8k. If you have a lot of headers, beefing that value up should ...
RitterKnight's user avatar
  • 6,582
2 votes

Asset URLs not HTTPS

An addition on this, probably for later versions of Craft than @brandonkelly's answer. You also need to be careful where Asset definitions are made in the CP - specifically, under Settings>Assets>...
narration_sd's user avatar
  • 1,697
2 votes

multi environment nginx, how to check $_SERVER['SERVER_NAME']

$_SERVER['SERVER_NAME'] is a global server variable (not a craft variable) and should be available. I don't use nginx, so I can't comment on where the $_SERVER['SERVER_NAME'] comes from exactly — but ...
Douglas McDonald's user avatar
2 votes

Nginx: index.php URLs still being served alongside pretty URLs

I fixed it by adding rewrite ^/index.php/(.*) /$1 permanent; to my server block. This will redirect all urls containing index.php and something after it to the contents after index.php. E.g. /index....
wouterds's user avatar
  • 121
2 votes
Accepted

Upload images bigger than 1MB not working

Nginx's setting client_max_body_size was set to its default value of 1M because it was not specified after provisioning the DO server with Laravel Forge. Weird thing is just that the user doesn't get ...
Johannes's user avatar
  • 740
2 votes
Accepted

Redirects with Craft and nginx

To fix the "No Input File" in your Nginx config, you'll need something like this inside if your php location handler: try_files $uri $uri/ /index.php?$query_string; That will cause it to run the ...
andrew.welch's user avatar
  • 11.4k
2 votes
Accepted

Exclude path in NGINX config (for FastCGI Caching)

I've tried doing this with headers and cookies, but haven't had any luck yet. What I think is happening is that these things are set after the request is made. You are correct. fastcgi_cache is ...
RitterKnight's user avatar
  • 6,582
2 votes
Accepted

When saving an Entry, I receive a JSON response rather than returning to the Entry's edit page

IMO, the issue is with this line. SetEnv HTTP_ACCEPT text/html,application/xhtml+xml,application/xml,application/json;q=0.9,*/*;q=0.8 With ACCEPT headers set to a fixed value, it's impossible for ...
Hieu Nguyen's user avatar
2 votes

shell script question on homestead

The best way to accomplish what you're trying to accomplish would be to utilize the after.sh shell script that Homestead provides. Check out Extending Homestead and Local Development with Vagrant / ...
andrew.welch's user avatar
  • 11.4k
2 votes

Nginx Config to serve .json without CORS restriction with ddev

I know this is an oldish question, but I hit a similar issue, so leaving this here for posterity... Per the ddev docs you can edit the nginx conf file at .ddev/nginx_full/nginx-site.conf. First of all,...
Tom Davies's user avatar
1 vote

Making a base url without /public

This is not so much a Craft question as a web server question. The directory structure of Craft is intended for the web server to have the public (or web in Craft 3) directory configured as the ...
Jeremy Gimbel's user avatar
1 vote
Accepted

Retour Redirects with Craft and nginx

Retour only works if the 404 actually is handled by Craft; my guess is that your Nginx config somehow is not passing along the 404 to Craft.
andrew.welch's user avatar
  • 11.4k
1 vote

Exclude path in NGINX config (for FastCGI Caching)

To the best of my knowledge it is not possible to skip/exclude caching based on the response with fastcgi cache.
Erik Weber's user avatar
1 vote

what is a base, no frills, nginx conf file to get up and running with Craft CMS and MAMP Pro

So there is Nginx-Craft which might actually be one of the configs you found, and decided there is too much superfluous stuff going on with it. The reason I never added a basic configuration for ...
andrew.welch's user avatar
  • 11.4k
1 vote
Accepted

Can I use an IP address instead of a FQDN?

Craft install (LAMP) LAMP Install Step 1: Install Apache and Allow in Firewall apt-get update apt-get install apache2 Set Global ServerName to Suppress Syntax Warnings apache2ctl configtest nano /...
Michael Purvis's user avatar
1 vote
Accepted

Craft Folder Error

I further adjusted permissions on the folders again and made a copy (everything with the craft folder in /public_html was working fine), moved that copy back under the public root. Switched the ...
Vin's user avatar
  • 373
1 vote

Craft 3 beta nginx config

This setup works fine with Craft 3: Nginx-Craft
andrew.welch's user avatar
  • 11.4k
1 vote

Load Balancing Craft CMS - Admin gets logged out instantly

If you can't enforce sticky sessions, then you'll need to provide a common place for all load balanced web server to save their PHP session files. By default PHP session files are file based and ...
Brad Bell's user avatar
  • 67.2k

Only top scored, non community-wiki answers of a minimum length are eligible