Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

need LARAVEL templates nginx and httpd ?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
10 posts • Page 1 of 1
sauvegardezvous99
Posts: 25
Joined: Mon Nov 24, 2014 11:48 pm

need LARAVEL templates nginx and httpd ?
  • Quote

Post by sauvegardezvous99 » Wed Dec 03, 2014 2:13 am

hello,

if you want to use Laravel with VestaCP, you need to create template for nginx and httpd
to get :

/home/youruser/web/yourdomain.com/public_html/public

/public/= will be your default directory,
and all others directories from Laravel like /app, /bootstrap, /vendor.... will be under /public_html/

I share with you 4 files that you can include into VestaCP : httpd, httpd ssl, nginx, nginx ssl.


httpd:

Code: Select all

<VirtualHost %ip%:%web_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
    DocumentRoot %docroot%/public/
    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
    <Directory %docroot%/public/>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>
    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    </Directory>

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid %user% %group%
        RGroups apache
    </IfModule>
    <IfModule itk.c>
        AssignUserID %user% %group%
    </IfModule>

    Include %home%/%user%/conf/web/%web_system%.%domain%.conf*

</VirtualHost>
httpd ssl

Code: Select all

<VirtualHost %ip%:%web_ssl_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
    DocumentRoot %sdocroot%/public/
    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
    <Directory %sdocroot%/public/>
        AllowOverride All
        SSLRequireSSL
        Options +Includes -Indexes +ExecCGI
    </Directory>
    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    </Directory>
    SSLEngine on
    SSLVerifyClient none
    SSLCertificateFile %ssl_crt%
    SSLCertificateKeyFile %ssl_key%
    %ssl_ca_str%SSLCertificateChainFile %ssl_ca%

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid %user% %group%
        RGroups apache
    </IfModule>
    <IfModule itk.c>
        AssignUserID %user% %group%
    </IfModule>

    Include %home%/%user%/conf/web/s%web_system%.%domain%.conf*

</VirtualHost>

nginx

Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    error_log  /var/log/httpd/domains/%domain%.error.log error;

    location / {
        proxy_pass      http://%ip%:%web_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           %docroot%/public/;
            access_log     /var/log/httpd/domains/%domain%.log combined;
            access_log     /var/log/httpd/domains/%domain%.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      http://%ip%:%web_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/nginx.%domain%.conf*;
}

nginx ssl

Code: Select all

server {
    listen      %ip%:%proxy_ssl_port%;
    server_name %domain_idn% %alias_idn%;
    ssl         on;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    error_log  /var/log/httpd/domains/%domain%.error.log error;

    location / {
        proxy_pass      https://%ip%:%web_ssl_port%;
        location ~* ^.+\.(%proxy_extentions%)$ {
            root           %sdocroot%/public/;
            access_log     /var/log/httpd/domains/%domain%.log combined;
            access_log     /var/log/httpd/domains/%domain%.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include %home%/%user%/conf/web/snginx.%domain%.conf*;
}
Top

sauvegardezvous99
Posts: 25
Joined: Mon Nov 24, 2014 11:48 pm

Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by sauvegardezvous99 » Thu Dec 04, 2014 2:42 am

hello,

after added theses template file, I select "laravel" for nginx and httpd,
go under "users" menu, click "rebuild", and
the additionnal folder called "public" is not added to "public_html/public/" like described in theses templates files, why?

find an error under /var/log/httpd/error_log :

Code: Select all

[Thu Dec 04 03:28:28 2014] [notice] SIGHUP received.  Attempting to restart
Warning: DocumentRoot [/home/admin/web/test.com/public_html/public/] does not exist
thx for any help.
Top

joem
Posts: 378
Joined: Thu Nov 13, 2014 8:33 am

Os: CentOS 6x
Web: nginx + php-fpm
Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by joem » Thu Dec 04, 2014 5:23 am

sauvegardezvous99 wrote:hello,

after added theses template file, I select "laravel" for nginx and httpd,
go under "users" menu, click "rebuild", and
the additionnal folder called "public" is not added to "public_html/public/" like described in theses templates files, why?

find an error under /var/log/httpd/error_log :

Code: Select all

[Thu Dec 04 03:28:28 2014] [notice] SIGHUP received.  Attempting to restart
Warning: DocumentRoot [/home/admin/web/test.com/public_html/public/] does not exist
thx for any help.

Open usr/local/vesta/func/rebuild.sh and under rebuild_user_conf() { function find
$HOMEDIR/$user/web/$domain/public_html \
Add below

Code: Select all

        $HOMEDIR/$user/web/$domain/public_html/public \
Find
chmod 751 $HOMEDIR/$user/web/$domain/public_html
Add below

Code: Select all

    chmod 751 $HOMEDIR/$user/web/$domain/public_html/public
Find
chown $user:$user $HOMEDIR/$user/web/$domain/public_html
Add below

Code: Select all

    chown $user:$user $HOMEDIR/$user/web/$domain/public_html/public

I have not tested this so be careful
Top

webass
Posts: 86
Joined: Sat Nov 15, 2014 1:16 am
Contact:
Contact webass
Skype

Os: Ubuntu 15x
Web: nginx + php-fpm
Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by webass » Sun Apr 24, 2016 11:45 pm

Mmh, when I create the tpl in correct folders, set chmod 755 and then rebuild everything and on the laravel app invoice ninja installed in web with a subdomain I change the web and the nginx template to the newly created, it says
"Error: apache2 restart failed"
and this is the error:
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 83 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/conf.d/vesta.conf: Could not open configuration file /home/admin/conf/web/apache2.conf: Permission denied
Action 'configtest' failed.
The Apache error log may have more information.
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 83 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/conf.d/vesta.conf: Could not open configuration file /home/admin/conf/web/apache2.conf: Permission denied
Action 'configtest' failed.
The Apache error log may have more information.
I havent touched these files at all.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by skurudo » Mon Apr 25, 2016 9:11 am

webass wrote: apache2: Syntax error on line 83 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/conf.d/vesta.conf: Could not open configuration file /home/admin/conf/web/apache2.conf: Permission denied

Code: Select all

ls -la /home/admin/conf/web/apache2.conf
webass wrote:I havent touched these files at all.
Hehe, who make rubild and make changes? ;-)
Top

webass
Posts: 86
Joined: Sat Nov 15, 2014 1:16 am
Contact:
Contact webass
Skype

Os: Ubuntu 15x
Web: nginx + php-fpm
Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by webass » Mon Apr 25, 2016 9:17 am

thats the output...

Code: Select all

-rw-r----- 1 root admin 22956 Apr 25 01:47 /home/admin/conf/web/apache2.conf
So I guess you wanna say, that I MADE changes cause I created the file and the rights are not properly set?
becuase it gives error:

Code: Select all

Could not open configuration file /home/admin/conf/web/apache2.conf: Permission denied
What should I do now, pls?
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by skurudo » Mon Apr 25, 2016 9:32 am

webass wrote:What should I do now, pls?
Nothing more in apache error log?

/var/log/apache2/error.log
/var/log/apache2/domains/$domain.error.log
Top

webass
Posts: 86
Joined: Sat Nov 15, 2014 1:16 am
Contact:
Contact webass
Skype

Os: Ubuntu 15x
Web: nginx + php-fpm
Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by webass » Mon Apr 25, 2016 9:38 am

Not really:

Code: Select all

 [Mon Apr 25 06:25:44.131739 2016] [:notice] [pid 13271] mod_ruid2/0.9.8 enabled
[Mon Apr 25 06:25:44.275277 2016] [mpm_prefork:notice] [pid 13271] AH00163: Apache/2.4.7 (Ubuntu) mod_fcgid/2.3.9 PHP/5.5.9-1ubuntu4.16 OpenSSL/1.0.1f configured -- resuming normal operations
[Mon Apr 25 06:25:44.275291 2016] [core:notice] [pid 13271] AH00094: Command line: '/usr/sbin/apache2'
  
This is from this morning.

But here:

Code: Select all

root@mail:/var/log/apache2/domains# cat inv.lisbert.de.error.log
[Sun Apr 24 23:55:21.751183 2016] [autoindex:error] [pid 16801] [client 5.79.72.116:41903] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Sun Apr 24 23:55:32.672613 2016] [autoindex:error] [pid 31672] [client 5.79.72.116:41906] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/ninja/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Sun Apr 24 23:56:37.500882 2016] [autoindex:error] [pid 16799] [client 5.79.72.116:41910] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/ninja/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Sun Apr 24 23:56:41.266995 2016] [autoindex:error] [pid 16800] [client 5.79.72.116:41911] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Sun Apr 24 23:57:50.387896 2016] [autoindex:error] [pid 17470] [client 5.79.72.116:41915] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Sun Apr 24 23:57:58.516134 2016] [autoindex:error] [pid 17472] [client 5.79.72.116:41918] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/ninja/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Mon Apr 25 00:02:50.645306 2016] [autoindex:error] [pid 16359] [client 5.79.72.116:42091] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/ninja/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Mon Apr 25 00:08:08.599262 2016] [autoindex:error] [pid 16358] [client 5.79.72.116:42379] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/ninja/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Mon Apr 25 00:08:10.766917 2016] [autoindex:error] [pid 16356] [client 5.79.72.116:42382] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/ninja/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Mon Apr 25 00:09:58.870389 2016] [autoindex:error] [pid 16719] [client 5.79.72.116:42479] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
[Mon Apr 25 00:14:19.306725 2016] [core:alert] [pid 18893] [client 5.79.72.116:42541] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:14:26.582083 2016] [core:alert] [pid 18894] [client 5.79.72.116:42542] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:16:32.925939 2016] [core:alert] [pid 18895] [client 5.79.72.116:42560] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:16:36.250269 2016] [core:alert] [pid 19192] [client 5.79.72.116:42561] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:19:44.339073 2016] [core:alert] [pid 18894] [client 5.79.72.116:42575] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:19:46.625389 2016] [core:alert] [pid 18893] [client 5.79.72.116:42576] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:20:18.474318 2016] [core:alert] [pid 19805] [client 5.79.72.116:42585] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:20:22.136704 2016] [core:alert] [pid 19807] [client 5.79.72.116:42587] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:20:25.617210 2016] [core:alert] [pid 19808] [client 5.79.72.116:42588] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:23:39.481591 2016] [core:alert] [pid 19805] [client 5.79.72.116:42599] /home/admin/web/inv.lisbert.de/public_html/ninja/.htaccess: <IfModule not allowed here
[Mon Apr 25 00:44:13.664468 2016] [autoindex:error] [pid 20561] [client 5.79.72.116:42708] AH01276: Cannot serve directory /home/admin/web/inv.lisbert.de/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
Am trying to get invoiceninja.com to run in a web account, I just created the sub domain and installed all fine, only the site isnt reachable because /public folder is typical for Laravel ...
Then I added it to vhost but this didnt work, and I reverted. and then I tried the method with the template.
But the web server doesnt restart then.
Top

webass
Posts: 86
Joined: Sat Nov 15, 2014 1:16 am
Contact:
Contact webass
Skype

Os: Ubuntu 15x
Web: nginx + php-fpm
Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by webass » Sat Jun 11, 2016 9:09 am

The app is still not accessible. I start over new.
But I dont understand the issue.
I just wantd to create the app inside a web folder so every thing should be readable and accessible by user already.
Top

webass
Posts: 86
Joined: Sat Nov 15, 2014 1:16 am
Contact:
Contact webass
Skype

Os: Ubuntu 15x
Web: nginx + php-fpm
Re: need LARAVEL templates nginx and httpd ?
  • Quote

Post by webass » Sat Jun 11, 2016 10:30 pm

I cant get a laravel app called invoice nija installed.
I just cannot start the setup process. moved the public content to puiblic_html and the rest to private/app_data
no idea what the problem is.
In index.php also set the paths to
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/

require __DIR__.'/../private/app_data/bootstrap/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/../private/app_data/bootstrap/app.php';

// set the public path to this directory
$app->bind('path.public', function() {
return __DIR__;
What is wrong??
I dont use any nginx and apache template cause this also dont work, the apachje or ngnix wont restart.
[Sun Jun 12 00:09:31.502387 2016] [core:notice] [pid 13512] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jun 12 00:11:15.075957 2016] [mpm_prefork:notice] [pid 13512] AH00171: Graceful restart requested, doing restart
[Sun Jun 12 00:11:15.223809 2016] [:notice] [pid 13512] mod_ruid2/0.9.8 enabled
[Sun Jun 12 00:11:15.224877 2016] [mpm_prefork:notice] [pid 13512] AH00163: Apache/2.4.7 (Ubuntu) mod_fcgid/2.3.9 PHP/5.5.9-1ubuntu4.17 OpenSSL/1.0.1f configured -- resuming normal operations
[Sun Jun 12 00:11:15.224905 2016] [core:notice] [pid 13512] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jun 12 00:11:29.882143 2016] [mpm_prefork:notice] [pid 13512] AH00169: caught SIGTERM, shutting down
and over and over this:
2016/06/12 00:27:02 [error] 24894#24894: *390 connect() failed (111: Connection refused) while connecting to upstream, client: 95.222.26.23, server: in.g-rrdia.de, request: "GET / HTTP/1.1", upstream: "http://3.12.33.116:8080/", host: "in.g-rrdia.de", referrer: "http://in.g-rrdia.de/"

[Sun Jun 12 00:06:37.534724 2016] [fcgid:warn] [pid 27873] [client 3.12.33.116:65500] mod_fcgid: stderr: PHP Fatal error: Class 'App' not found in /home/admin/web/in.g-rrdia.de/public_html/index.php on line 37
[Sun Jun 12 00:07:23.192837 2016] [:error] [pid 28537] [client 3.12.33.116:65512] PHP Fatal error: Class 'App' not found in /home/admin/web/in.g-rrdia.de/public_html/index.php on line 37
Top


Post Reply
  • Print view

10 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password