sentora / sentora-core

Sentora is a web hosting control panel written in PHP for *NIX
GNU General Public License v3.0
648 stars 446 forks source link

View hosting without domain. #104

Closed ghost closed 5 years ago

ghost commented 9 years ago

Would it be possible to add something to view the files on a hosting account via a browser without having to use a domain. For example, with cPanel, you can access node.example.org/~username and it will show the Files on the hosting for that account. If you could, that would be great.

allebb commented 9 years ago

Added as a feature request - will look to implement in future.

ghost commented 9 years ago

Thanks :)

allebb commented 9 years ago

No problem :)

On 28 January 2015 at 13:27, QuakeMediaUK notifications@github.com wrote:

Thanks :)

— Reply to this email directly or view it on GitHub https://github.com/sentora/sentora-core/issues/104#issuecomment-71834188 .

TGates71 commented 9 years ago

Basically this is the DNS-less preview. Windows:

</virtualhost>
# Add Alias for DNS-Less Previews
<VirtualHost *:80>
ServerName xxx.xxx.xxx.xxx
DocumentRoot c:/zpanel/panel/
AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) c:/zpanel/hostdata/$1/public_html/$2
<Directory c:/zpanel/hostdata>
Options FollowSymLinks Indexes
AllowOverride All
Order Allow,Deny
Allow from all
DirectoryIndex index.php
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_admin_value upload_tmp_dir c:/zpanel/temp
    </IfModule>
</Directory>

Need to replace xxx.xxx.xxx.xxx with your server's public IP and may need to update the paths for your OS (Current paths are for Windows) You enter this as a Global ZPanel/Sentora Entry in Module Admin>Apache Admin This could be customized to use your main panel domain instead of IP Example usage: http://75.68.13.153/~zadmin/mach-hosting_com/

ghost commented 9 years ago

Added to Global Sentora on CentOS and has appeared to stop Apache from starting.

allebb commented 9 years ago

Did you update the paths ;) - If Apache isn't working check the Apache error logs on your server, it should help pinpoint what the problem is bud.

ghost commented 9 years ago

This doesn't work for CentOS and will stop Apache from starting.

allebb commented 9 years ago

How come you close it? - Did you not want me to implement this feature in future? (so you can easily enable and it be supported in the panel?)

@TGates71 gave you the example as a quick work around for now :)

ghost commented 9 years ago

Yes, sorry. Def want it adding. Must have clicked the wrong button.

TGates71 commented 9 years ago

This works on ALL OS that run apache. You must not have updated the paths properly. OOPS! recheck the addition above, I forgot to add </virtualhost> at the beginning as I just copy/paste right from my settings.

Make sure you update c:/zpanel/ to your proper paths.

jd1pinoy commented 9 years ago

AFAIK this can be added in CentOS "/etc/sentora/configs/apache/httpd.conf" file and add this line: AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) /var/sentora/hostdata/$1/public_html/$2

example httpd.conf: -# Sentora Apache Include file -# Written by Bobby Allen, 15/05/2011

-# Set the Sentora Alias (used for development, sable will eventually use a VHOST) -#Alias /Sentora /etc/sentora/panel

-# Set a default server name for the master configuration to supress Apache daemon warnings -ServerName localhost -AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) /var/sentora/hostdata/$1/public_html/$2 #<-- add it to this line -# Setup the directory settings and PHP security flags for the Sentora application directory. -<Directory /etc/sentora/panel>

Yeah make sure to use correct path. then view your account/domain: http://xxx.xxx.xxx.xxx/~useraccount/domain_dirpath/

I tried adding AliasMatch in Global Sentora Entry but it doesn't work.

dssilva commented 9 years ago

Hi,

When I try the method above the error 403 Forbidden is showed. What I did wrong?

drjaydenm commented 8 years ago

@dssilva, I have gotten this to work on Ubuntu 14.04. Using @jd1pinoy solution of modifying the "/etc/sentora/configs/apache/httpd.conf" file. Edit the "/etc/sentora/configs/apache/httpd.conf" file and add the following lines:

AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) /var/sentora/hostdata/$1/public_html/$2

# Setup folder permissions for DNS-less sites
<Directory /var/sentora/hostdata>
    Options FollowSymLinks
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
    DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off 
        php_admin_value upload_tmp_dir /var/sentora/temp
    </IfModule>
</Directory>

The start of the modified file should now look something like this:

# Sentora Apache Include file
# Written by Bobby Allen, 15/05/2011

# Set the Sentora Alias (used for development, sable will eventually use a VHOST)
#Alias /Sentora /etc/sentora/panel

# Set a default server name for the master configuration to supress Apache daemon warnings
ServerName localhost
AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) /var/sentora/hostdata/$1/public_html/$2

# Setup folder permissions for DNS-less sites
<Directory /var/sentora/hostdata>
    Options FollowSymLinks
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
    DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off 
        php_admin_value upload_tmp_dir /var/sentora/temp
    </IfModule>
</Directory>

# Setup the directory settings and PHP security flags for the Sentora application directory.
<Directory /etc/sentora/panel>
    Options +FollowSymLinks
    DirectoryIndex index.php
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_admin_value upload_tmp_dir /var/sentora/temp
    </IfModule>
</Directory>

The key to fixing the 403 Forbidden errors seemed to be the Require all granted rule.

TGates71 commented 8 years ago

Correct about the Require all granted. But you should NOT be editing the httpd.conf file rather add it as a Global Sentora Entry in Admin > Module Admin > Apache Config > Global Sentora Entry.

drjaydenm commented 8 years ago

I couldn't seem to get it to work correctly by placing the rules in the settings, it seemed to be ignored. Have you got any tips to get it working correctly?

drjaydenm commented 8 years ago

Just an update, I have managed to get this all working using the Global Sentora Entry in the Apache Settings in Sentora. All I needed to do was escape out of the VHost rule that Sentora places the content of the Global Sentora Entry into.

Following @TGates71 instructions, go to: Admin > Module Admin > Apache Config, and then add the following to the Global Sentora Entry field:

# Escape out of VHost config
</VirtualHost>

# Set the Sentora Alias (used for development, stable will eventually use a VHOST)
AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) /var/sentora/hostdata/$1/public_html/$2

# Setup folder permissions for DNS-less sites
<Directory /var/sentora/hostdata>
    Options FollowSymLinks
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
    DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off 
        php_admin_value upload_tmp_dir /var/sentora/temp
    </IfModule>
</Directory>

# Enter back into the VHost config
<VirtualHost *:80>

Once the daemon runs, and apache is restarted, this should work correctly and you should be able to access sites through a link like the following http://DOMAIN_NAME/~zadmin/SITE_FOLDER_NAME/

Guillermonnn commented 8 years ago

Thank you it works perfectly !!!!!

erm3nda commented 8 years ago

I tried and get a Forbidden. Shoul I change anything else?

kemboidickson commented 8 years ago

It works good, can I remove the "~zadmin" part?

TGates71 commented 8 years ago

What do you mean? That us how you view the hosted pages with out a domain. ~[username]

PREScriptZ commented 5 years ago

Just an update, I have managed to get this all working using the Global Sentora Entry in the Apache Settings in Sentora. All I needed to do was escape out of the VHost rule that Sentora places the content of the Global Sentora Entry into.

Following @TGates71 instructions, go to: Admin > Module Admin > Apache Config, and then add the following to the Global Sentora Entry field:

# Escape out of VHost config
</VirtualHost>

# Set the Sentora Alias (used for development, stable will eventually use a VHOST)
AliasMatch ^/~([a-zA-Z0-9]+)/?(.*) /var/sentora/hostdata/$1/public_html/$2

# Setup folder permissions for DNS-less sites
<Directory /var/sentora/hostdata>
    Options FollowSymLinks
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
    DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php
        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off 
        php_admin_value upload_tmp_dir /var/sentora/temp
    </IfModule>
</Directory>

# Enter back into the VHost config
<VirtualHost *:80>

Once the daemon runs, and apache is restarted, this should work correctly and you should be able to access sites through a link like the following http://DOMAIN_NAME/~zadmin/SITE_FOLDER_NAME/

hi there

followed your guide, may access to TXT files, but error 500 with PHP files