Operating System & Version
CentOS v7.9.2009
cPanel & WHM Version
cPanel & WHM v102.0.12 (STANDARD)

Mbelisle

Member
May 3, 2022
5
0
1
Canada
cPanel Access Level
Root Administrator
Hello, thank you in advance for any help, I've been trying for a few days now and I'm lost.

We currently have a WHM + cPanel host. With a main domain like school.com
Each students have a subdomain (with their own cPanel): student1.school.com

Now, each students are building a Symfony app in their subdomain: student1.school.com/symfony
To view their Website, we need to go to student1.school.com/symfony/public

In the old days, we used Wampserver with aliases but now with the WHM Include Editor, I can't seem to find what I need to do the same. I tried every .htaccess variation I found online but to no success.

In Wampserver we had for exemple:

Alias /student1/symfony "e:/inetpub/student1/symfony/public"
<Directory "e:/inetpub/student1/symfony/public">
AllowOverride All
Require all granted
</Directory>
What would be the WHM alternative for our current setup?

Thank you very much!
 

Mbelisle

Member
May 3, 2022
5
0
1
Canada
cPanel Access Level
Root Administrator
Hey there! I'm not completely sure what you're trying to change from the previous information. Are you trying to adjust the URL the students use to access the site?
Yes, students should have access from student1.school.com/symfony directly instead of adding the /public in the URL.
I suppose that I would need to adjust the path that we used in Wampserver, to create aliases. But what would the correct path be if we take the exemples I listed in my first post?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,307
2,440
363
cPanel Access Level
Root Administrator
Thanks for the details. We have a guide to changing the document roots here:


The same steps would still apply to sub/addon domains, so that's the best way to make the change at the Apache and server configuration level.
 

Mbelisle

Member
May 3, 2022
5
0
1
Canada
cPanel Access Level
Root Administrator
Thanks for the details. We have a guide to changing the document roots here:


The same steps would still apply to sub/addon domains, so that's the best way to make the change at the Apache and server configuration level.
I really appreciate the help!
The problem with this guide is that it doesn't target the folder, only sub/addon domains. Students may have multiple websites on their cPanel, let's say a Wordpress and a Symfony. Both are on the same subdomain (student1.school.com/wordpress and student1.school.com/symfony).

Is there a way to target those instead? Or do we must use a subsubdomain like symfony.student1.school.com ?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,307
2,440
363
cPanel Access Level
Root Administrator
You can make the document root any folder you like using those steps - it doesn't have to be a subdomain. For example, a domain with the student 1 subdomain would look like this:

Code:
-rw-r--r--.  1 root root     1.4K Mar  8 12:43 maindomain.com
-rw-r--r--.  1 root root     1.3K Mar  8 12:43 maindomain.com.cache
-rw-r--r--.  1 root root       17 Mar  8 12:43 maindomain.com.php-fpm.cache
-rw-r--r--.  1 root root       20 Mar  8 12:43 maindomain.com.php-fpm.yaml
-rw-r--r--   1 root root      373 Apr 22 10:48 maindomain.com_SSL
-rw-r--r--   1 root root      415 Apr 22 10:48 maindomain.com_SSL.cache
-rw-r--r--   1 root root      117 May  3 10:52 main
-rw-r--r--   1 root root      116 May  3 10:52 main.cache
-rw-r--r--   1 root root      407 May  3 10:52 student1.maindomain.com
-rw-r--r--   1 root root      444 May  3 10:52 student1.maindomain.com.cache
-rw-r--r--   1 root root       17 May  3 10:52 student1.maindomain.com.php-fpm.cache
-rw-r--r--   1 root root       20 May  3 10:52 student1.maindomain.com.php-fpm.yaml
-rw-r--r--   1 root root      404 May  3 10:52 student1.maindomain.com_SSL
-rw-r--r--   1 root root      448 May  3 10:52 student1.maindomain.com_SSL.cache
You'd be able to edit the student1.maindomain.com and student1.maindomain.com_SSL files to changed the document root there. Here's an example of what is in those files:

Code:
documentroot: /home/maindomain/student1.maindomain.com
group: maindomain
hascgi: 0
homedir: /home/maindomain
ip: 172.105.107.152
ipv6: ~
no_cache_update: 0
owner: root
phpopenbasedirprotect: 1
phpversion: ea-php80
serveradmin: [email protected]
serveralias: www.student1.maindomain.com
servername: student1.maindomain.com
usecanonicalname: 'Off'
user: maindomain
userdirprotect: ''
Does that help with your situation?
 

Mbelisle

Member
May 3, 2022
5
0
1
Canada
cPanel Access Level
Root Administrator
Ok so I tried so many things this PM and it is still not working. o_O
Your last suggestion @cPRex gives me a weird "No input file specified." empty page. Google ain't really helping with this either.

I also used the subdomain itself (student1.school.com) because I don't find how to use a folder instead (student1.school.com/symfony). As in not using the subdomain root folder...
 

PrunellaCox

Registered
Mar 22, 2023
4
0
1
Moldova
cPanel Access Level
Root Administrator
You can make the document root any folder you like using those steps - it doesn't have to be a subdomain. For example, a domain with the student 1 subdomain would look like this:

Code:
-rw-r--r--.  1 root root     1.4K Mar  8 12:43 maindomain.com
-rw-r--r--.  1 root root     1.3K Mar  8 12:43 maindomain.com.cache
-rw-r--r--.  1 root root       17 Mar  8 12:43 maindomain.com.php-fpm.cache
-rw-r--r--.  1 root root       20 Mar  8 12:43 maindomain.com.php-fpm.yaml
-rw-r--r--   1 root root      373 Apr 22 10:48 maindomain.com_SSL
-rw-r--r--   1 root root      415 Apr 22 10:48 maindomain.com_SSL.cache
-rw-r--r--   1 root root      117 May  3 10:52 main
-rw-r--r--   1 root root      116 May  3 10:52 main.cache
-rw-r--r--   1 root root      407 May  3 10:52 student1.maindomain.com
-rw-r--r--   1 root root      444 May  3 10:52 student1.maindomain.com.cache
-rw-r--r--   1 root root       17 May  3 10:52 student1.maindomain.com.php-fpm.cache
-rw-r--r--   1 root root       20 May  3 10:52 student1.maindomain.com.php-fpm.yaml
-rw-r--r--   1 root root      404 May  3 10:52 student1.maindomain.com_SSL
-rw-r--r--   1 root root      448 May  3 10:52 student1.maindomain.com_SSL.cache
You'd be able to edit the student1.maindomain.com and student1.maindomain.com_SSL files to changed the document root there. Here's an example of what is in those files:

Code:
documentroot: /home/maindomain/student1.maindomain.com
group: maindomain
hascgi: 0
homedir: /home/maindomain
ip: 172.105.107.152
ipv6: ~
no_cache_update: 0
owner: root
phpopenbasedirprotect: 1
phpversion: ea-php80
serveradmin: [email protected]
serveralias: www.student1.maindomain.com
servername: student1.maindomain.com
usecanonicalname: 'Off'
user: maindomain
userdirprotect: ''
https://papersowl.com/write-my-paper-for-me is the source with experts who write my paper for me.
Does that help with your situation?
Hello to everyone and sorry to bother such an old thread, but I have a question, please!
Will PHP scripts running on the server be restricted to accessing only certain files in the PHP configuration? Or I've got smth wrongo_O... I try figuring it out
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,307
2,440
363
cPanel Access Level
Root Administrator
Can you get us more specific details about what it can't access? The scripts would be limited to accessing files on the same cPanel account, but having more details on your particular situation would likely help us get you better details.