prestashop backup omitting cache folder? - backup

im backing up my prestashop hosting with lftp (I havent got ssh/rsync access)
lftp -e "set ftp:ssl-allow off; mirror --only-missing --only-newer
public_html /var/www/example.com " -u p,w ftp.example.com
can i omit all the cache folders from the backup?

Related

Apache can't serve DocumentRoot : no execute permission error

I am trying to migrate a web application from a Slackware config of Apache to a CentOS 7 one. DocumentRoot set to /home/STORAGE and there is a simple index.html file in it for testing. Both /home/STORAGE and index.html have 777 permissions set, yet Apache reports :
access to /index.html denied ... because search permissions are missing on a component of the path.
On the other hand, phpMyAdmin works fine, configured with a separate .conf file in /etc/httpd/conf.d . I tried using their example to make a .conf file for my app, but it still reports the same error. I don't even know where to start looking here.
EDIT:
I think this has something to do with the user of Apache. It is set to a local user in httpd.conf not to root, but the only pages the server serves are those in directories owned by root.
It was not a permission error but a Selinux issue. I decided to use the default /var/www/html for the application but still, had to allow write access to some dirs. Here is what I typed:
sudo chcon -t httpd_sys_rw_content_t /some/dir/in/var/www/html -R
The first time I typed it without -R and the permissions didn't change (check with ls -Z /dir/path). Now it is fine.

Access forbidden on apache2 on ubuntu14.04

I have installed apache2 server on Ubuntu 14.04. It is working well with the files and directories which i have created here after installation, but if i copy any file or folder from anywhere else (already written) then is gives Forbidden error message.
Thanks in advance.
For a file to be accessible by apache2, it should be owned by the user which runs the apache2 server. On most systems the user is www-data or httpd or apache. To find which user is that, just look into your apache2.conf or httpd.conf. Once you know the user, make it the owner of the copied files/folders or reiterate it for the whole /var/www//html folder.
sudo chown -R www-data:www-data /var/www/html
This should do it. But, if it doesn't, verify that the user has at least read and execute permissions on the folder (write also, if you need to write some data through your script).

How to create public_html folder?

I accidentally deleted my "Public_html" folder from the web server. After accessing by fileZilla agent there is no public_html folder present. How can i upload the files to the web server and how can i create it again ?
You should access via ssh to the server in order to have access to the console command. From there if your server is linux:
mkdir ~/public_html
fs sa ~/public_html system:anyuser read
or else, if your server is IIS:
cd /home/[yourUser]/domains/domain
mkdir public_html
chown [yourUser]:[yourUser] public_html
chmod 755 public_html
replace [yourUser] with your user name.
Hope this helps.
In FileZilla, right-click in the remote pane and select Create Directory. Name it 'public_html'.
Secondly, drag your files from the local panel on the local pane to the remote pane to upload files to your public_html folder.

Apache 403 on certain folders

I'm running dev server on Centos 6.4 with Apache 2.2. I just moved a site from the production to dev to perform upgrades. I modified file owner to apache:apache (httpd user) and set all directories to 755 and files to 644. I have few other sites in the DocumentRoot folder with similar settings and they run fine (using same CMS, PHP, MySQL versions etc).
I have no virtual hosts defined and Allow all on everything. httpd.conf is default.
I'm not able to make site working from the folder I just moved from the production. I'm getting 403 every time.
As suggested in
https://serverfault.com/questions/272947/apache-on-centos-5-6-gives-me-permissions-denied-error/272956#272956
Usually that comes from Selinux not giving access to the folder. do
ls -alZ /var/www
and if the html folder doesn't have the context system_u:object_r:httpd_sys_content_t, fix it with chcon
chcon -v -R --type=httpd_sys_content_t /var/www/html
http://wiki.centos.org/HowTos/SELinux

access_log is huge, not being archived. how to reset it?

I have discovered that my access_log is occupying most of my HDD. It's over 200 GB in size. How can I reset it ?
I am using Apache 2.2.3 on a CentOS server with Plesk.
Thank you guys !
knx'answer is good, but I would suggest to rename the log, and create a new one, so that you can restart apache without waiting for the access log to be compressed, which can take a while if it's big.
needs access to ssh
First, rename the current log file:
mv /var/log/apache/access.log /var/log/apache/access.log.1
Second, create a new log file and give the same permissions, owner/group and selinux context as the original one:
touch /var/log/apache/access.log
chown --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
chmod --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
restorecon --reference=/var/log/apache/access.log.1 /var/log/apache/access.log
(probably need to be root to do that)
Next, restart apache
Then Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this:
gzip -c /var/log/apache/access.log.1 > /var/log/apache/access.log.1.gz
these 4 points are what logrotate do automatically.
If you have access by SSH to the server, then you can:
1) Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this:
gzip -c /var/log/apache/access.log > /var/log/apache/access.log.gz
2) Clear the current file
echo > /var/log/apache/access.log
3) Restart apache
Also as Dez has suggested consider using logrotate for production grade apache log archiving.
Use the logrotate daemon in order to have a clean maintenance of your logs, specially, the apache related logs.
A brief info about logrotate: http://www.scriptinstallation.in/logrotate.html
If on Ubuntu do:
sudo su
cd /var/log/apache2
rm access.log
rm error.log
touch access.log
When creating that access log it magically starts the error log too.
I know this post is ages old, but I just had same problem and no answer covers it correctly.
The point is the apache creates the file as access_log, according to its configuration. However, logrotate only looks for *.log, hence the name does not match the search pattern.
Solutions: Either you add *_log to logrotate configuration, or change the apache configuration to make it create the log file named access.log. Changing apache configuration requires apache reload.
A simple solution is to disable access_log, commenting only one line on the configuration file.
Source: https://www.mydigitallife.info/how-to-disable-and-turn-off-apache-httpd-access-and-error-log/
For Plesk users:
https://stackoverflow.com/a/41000240/1792240
Rename the file, create a new access_log, then restart Apache.
Rename the file to different filename and create new file with the name access_log and restart apache (otherwise apache keeps the lock on the file and don't "see" the file change)