Apache 2 on Ubuntu shows 403 forbidden on certain urls - zend-framework

I have a Zend Framework application. Almost all of my urls work fine. However, any url that starts with /resources gives me a 403 forbidden error (e.g.: /resources/add, /resources/edit). The strange thing is, when I tested it on my Windows machine via XAMP, everything worked fine. Is there something special about urls starting with /resources that makes Apache2 think it should not allow access?

Your issue seems a permissions problem, nothing related to URLs. Check directories to be 755 and files 644 in the Ubuntu server where you deployed your application.
Run this in the root directory of your application and should get you going:
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Related

I change file permitions of root

I didn't check that I'm at root and I ran
chown www-data:www-data -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
I don't have backup thats why I cant restore
all my website's goes 503 :(
The last thing that I saw on command was http://prntscr.com/oags7v before I scream
How can I recover the original ownership of the files and their permissions with chown and chmod?
thank you in advance & best regards...
At this point... first read The Tao of Backup. Better late than never.
Then, back up anything yours. Any apps you made, any data you have. Anything that is not OS.
Wipe the machine clean, reinstall OS. Reinstall any necessary software.
Put your data back, and chown them appropriately.
Make sure everything works.
Then see if you learned anything from The Tao of Backup. Reread as needed.

Getting blank page after changing the deploy mode to developer

fresh installed Magento 2.2.3 with sample data everything worked fine. until I changed the deploy: mode to the developer. now it is showing a blank page, there is no error only blank screen.
refresh the cache, deleted all cache folders, generated folder and cleared pub/static folder too ( leaving .htaccess ) file. recompiled the code, ran setup upgrade commands but without any solution.
please help.
You can try enabling the developer mode to check the error(s) if any.
Also please try changing the permissions of the file and folder to the following:
from the root directory:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
find ./var -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
You should enable exception printing by renaming local.xml.sample to local.xml in pub/errors. Also check exception and system log in var/log

Unable to determine status of lock file in the data directory

I am trying to run multiple mongod instances on the same centos machine with different config files.
I am getting following error while running the instance as a service:
sudo service mongod1 start
/var/lib/mongo1: boost::filesystem::status: Permission denied: "/var/lib/mongo1/mongod.lock"
I have added the permissions for the /var/lib/mongo1 using:
sudo chmod -R 600 /var/lib/mongo1
I also tried with 700, 755 and 777 at the end but nothing seems to work.
mongod:mongod is the owner of the folder /var/lib/mongo1
Any help is appreciated.
I know this is really late but I was struggling with this for days and just now found the fix. That being said for future users running into this issue the solution if you're using SELinux is to check the context of the default mongodb path against your own to make sure they are the same by executing
ls -dZ /var/lib/mongo/
the output should look something like this
drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 /var/lib/mongo/
if it's not then you can copy it by doing
chcon -R --reference=/var/lib/mongo /your/path
the source can be found here
Maybe the lock file is missing? Which might explain why chmod isn't having the desired effect...
Try:
touch /var/mongo1/mongod.lock
chown mongod:mongod
chmod 600 /var/mongo1/mongod.lock
important :
Don't try to restart mongo using sudo as it tries to change the user to root where as /var/lib/mongodb owner is mongod:mongod
Please remember that Directories needs to have execute permission, but the files within the directories do not need to execute permission.
The following 2 commands worked for me
$ sudo chmod -R 770 /var/lib/mongo1
$ sudo find /var/lib/mongo1 -type f -exec chmod 660 {} \;
This will first give everything under /var/lib/mongo1 execute permission, and then return all the normal files to having only read and write, but not execute.

How to remove all files starting with a certain string in particular path

I used centos 6.5
in / path I have a lot of files that started with this name tmp_
I work with a user franco who has a limit permission ( and I can't add permission to this user )
and with FileZilla when I try to delete these files, I have a permission denied message.
so the solution is to delete these files with command in putty tool
because in putty, I can use command like this sudo rm .....
but I did not find the exact command.
I found this kind of command :
rm ./-tmp_
I want only to delete the files which are only in \ path and not in its subdirectories and which started with tmp_
I work with critical system so I want to be sure before execute any command.
To find target files use :
This will just print files on console.
find / -maxdepth 1 -type f -name 'tmp_*'
To remove files (not directories):
find / -maxdepth 1 -type f -name 'tmp_*' -exec rm -f {} \;
Please use -maxdepth attribute if you want to target files to specific depth.
The command "sudo rm -rf /tmp_" is worked if the /tmp_ directory not used for you.

centos - plesk - apache file owner

I have a question.
Server: VPS
System: Centos 6 + Plesk 11
save_mode = off;
Problem:
I have a script that creates folders for users.
mkdir('/var/www/vhosts/website.com/private/'.$user_id.', 0755, true);
And true the Plesk API i create a ftp user for the new folder.
The problem is that my php script create the new whit the following group and user: apache(502)/503
The ftp users has no rights in this folder at all.
If i create folders true ftp the group and user are: 505/10000
It is because your PHP script is running in mod_php mode and executes under Apache user. The easiest solution would be to switch your site to run in FastCGI mode, so that PHP script is running under your PHP user and there is no ownership conflict.
The question is pretty old, but I found a solution so thought it might be helpful for someone.
Following commands needs to be executed using root access.
cd /var/www/vhosts/yourdomain.com
chown -R youruser:psacln httpdocs
chmod -R g+w httpdocs/wp-content
find httpdocs -type d -exec chmod g+s {} \;
For details explanation you can view the link
http://www.ryanbelanger.com/wordpress-file-permissions/