Using WinSCP to Edit Website Files Through SFTP

1

1

I'm logging in through SFTP using WinSCP. I am able to see all the files of my website and the whole directory structure. However, if I try to edit a file, e.g. an HTML or CSS file, I am able to re-upload it to the server but the changes don't take effect on the website! I thought it was a permissions issue so I assigned 0777 using WinSCP to all the files and directories on the website, but still no changes take effect. What am I doing wrong that I can't edit files--only VIEW them--in WinSCP?

Rick Helston

Posted 2015-06-11T18:50:50.667

Reputation: 121

Are you sure you are not modifying a COPY of the file that WInSCP has put in temp or elsewhere and then not re-uploading that copy? Have you setup an external editor as per http://winscp.net/eng/docs/ui_pref_editor#preference ?

– ssnobody – 2015-06-12T01:14:11.573

Do you have a shell access to the server? Can you check file timestamp (in shell, not WinSCP) before the upload and after the upload? Is it changed to a later time after the upload? – Martin Prikryl – 2015-06-12T07:22:03.990

Answers

0

Provided that the directory you are modifying is in fact the webroot, the changes should take effect right away, unless cache is ruining it for you.

First of all, ensure that there is no serverside cache running, such as Varnish. After that, ensure there's no transparent caching somewhere on your end, such as Squid. With those two out of the way, try clearing your browser cache. If still no luck, ensure that the webserver is in fact reading the directory you are modifying as the webroot.

If all else fails, you can consult the server log, and what you want to look for is a response of 304 or anything related to a cache hit.

Jarmund

Posted 2015-06-11T18:50:50.667

Reputation: 5 155

I believe it might be some server side cache like Varnish because I just SSH'd into the server and the files are there. How do I clear/reset the cache on the server? Is there a Linux command I can use? – Rick Helston – 2015-06-11T20:57:35.570

@RickHelston If it is Varnish, then the correct command is varnishadm -T 127.0.0.1:6082 url.purge – Jarmund – 2015-06-11T21:33:05.823

Before purging, is there a way to test if I do have Varnish installed on the server? – Rick Helston – 2015-06-11T21:40:52.487

ps aux | grep varnishd – Jarmund – 2015-06-11T21:50:44.120

Tried varnishadm -T 127.0.0.1:6082 url.purge but it didn't work. – Rick Helston – 2015-06-11T21:58:58.827

-bash: varnishadm: command not found – Rick Helston – 2015-06-11T22:16:03.473