How to create public_html folder? - apache

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.

Related

How can I give an apache server access to a mounted folder?

My apache server needs to serve files located in a mounted directory in the root folder. However, when the process attempts to access a file in that directory I get...
PermissionError: [Errno 13] Permission denined 'path/to/file'
How can I give the apache server access to the files safely?
I am working on a CentOS machine.
First unmount the shared directory.
chmod 775 <path>
chgrp apache <path>
Remount.
Would be one relatively safe way.
(assumes your apache user primary group is apache).

Apache2 relative paths not working

Good Morning,
I am currently setting up and apache2 server on my raspberry pi. My index.html file is in the directory /var/www/html and the file is loading fine when I go to the IP address. However, the images located in /var/www/html/img are not loading. The html is like this: <img alt="image1" src="img/picture1.png">. When I right click on the alternative image icon, and select open image in new tab, I get:
You don't have permission to access /img/picture1.png on this server.
Server unable to read htaccess file, denying access to be safe
How can I prevent this and make the user able to access the image?
Many thanks,
Try
chmod -R 755 /img/
this will set the permission for all files in the folder readable and executable for all, and also writable by the owner.
The output will be in the form
-rwxr-xr-x 1 root root 0 Apr 5 12:38 picture1.jpg

Folder missing while logged in as root user to ec2 instance

I connected to ec2 instance using filezilla and uploaded a folder. When I login from putty to access the folder, i see the folder in .ssh directory. However, when login as a root user (sudo -i), I don't see the folder in .ssh directory. Any idea why this is happening?

permission Apache PHP public_html

I'm newbie in the web development, and I'm trying to make a website. So, my website works fine on the server but not on my own (Apache). My sources are in ~/public_html/. The problem is I don't have permissions on the sub/sub directory, I mean, when it's a directory, it works fine, when it's directory in a directory, it doesn't. (403 Forbidden). I don't change my default Apache configuration excluding for include mysql and php.
All my directories have the same permissions. Maybe I need to configure something for that?
Thanks
I used this little script found at this link http://boomshadow.net/tech/fixes/fixperms-script/
Fixperms – for one single user
To use the fixperms script, simply log into your server as root, wget the file from our server, then run it. Type in the cPanel username and it will run only for that particular account.
It does not matter which directory you are in when you run fixperms. You can be in the user’s home directory, the server root, etc. The script will not affect anything outside of the particular user’s folder.
Should be done in SSH
root#example [~]# wget boomshadow.net/tools-utils/fixperms.sh
root#example [~]# sh ./fixperms.sh -a USER-NAME
Fixperms – for all of the users
If you would like fix the permissions for every user on your cPanel server, simply use the ‘-all’ option:
root#example [~]# wget boomshadow.net/tools-utils/fixperms.sh
root#example [~]#sh ./fixperms.sh -all

How do I find/access account public_html directories from my root access on my dedicated server - WHM cpanel

I have dedicated server and have root accesss via ssh putty - I have 1 account set up on the server but I'm trying to workout how i can access the public_html directory of this account from root#ds-44498 [~]# the public_html in the root is empty.
I'm trying to copy a file from the root to the account public_html folder
I have WHM - cpanel
Thanks
Have found answer: in /home/accountname/public_html/
thanks