Laravel and apache2: 403 forbidden











up vote
2
down vote

favorite












I am trying to deploy my Laravel app in apache2 locally, however when trying to browse to http://myapp.localhost.com/ I am getting the following error:



Forbidden

You don't have permission to access / on this server.

Apache/2.4.7 (Ubuntu) Server at myapp.localhost.com Port 80


I created myapp.conf in /etc/apache2/sites-available to set up the virtual host:



<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/user/projects/myapp/public"
<Directory "/home/user/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>


And created a symlink in /etc/apache2/sites-enabled (sudo ln -s ../sites-available/myapp.conf)



Also edited the /etc/hosts file and added:



127.0.0.1   myapp.localhost.com


Any clue why I am getting this error? I am also having the same problem when trying to deploy the application to heroku, which also uses apache2.










share|improve this question
























  • If needed PM me. I'll have a look to any questions you have. But your virtual host seems to be missing some options ;)
    – Rinzwind
    Jan 16 '15 at 19:09










  • sure, I'd like you to ask you soome questions
    – dabadaba
    Jan 16 '15 at 19:27















up vote
2
down vote

favorite












I am trying to deploy my Laravel app in apache2 locally, however when trying to browse to http://myapp.localhost.com/ I am getting the following error:



Forbidden

You don't have permission to access / on this server.

Apache/2.4.7 (Ubuntu) Server at myapp.localhost.com Port 80


I created myapp.conf in /etc/apache2/sites-available to set up the virtual host:



<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/user/projects/myapp/public"
<Directory "/home/user/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>


And created a symlink in /etc/apache2/sites-enabled (sudo ln -s ../sites-available/myapp.conf)



Also edited the /etc/hosts file and added:



127.0.0.1   myapp.localhost.com


Any clue why I am getting this error? I am also having the same problem when trying to deploy the application to heroku, which also uses apache2.










share|improve this question
























  • If needed PM me. I'll have a look to any questions you have. But your virtual host seems to be missing some options ;)
    – Rinzwind
    Jan 16 '15 at 19:09










  • sure, I'd like you to ask you soome questions
    – dabadaba
    Jan 16 '15 at 19:27













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am trying to deploy my Laravel app in apache2 locally, however when trying to browse to http://myapp.localhost.com/ I am getting the following error:



Forbidden

You don't have permission to access / on this server.

Apache/2.4.7 (Ubuntu) Server at myapp.localhost.com Port 80


I created myapp.conf in /etc/apache2/sites-available to set up the virtual host:



<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/user/projects/myapp/public"
<Directory "/home/user/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>


And created a symlink in /etc/apache2/sites-enabled (sudo ln -s ../sites-available/myapp.conf)



Also edited the /etc/hosts file and added:



127.0.0.1   myapp.localhost.com


Any clue why I am getting this error? I am also having the same problem when trying to deploy the application to heroku, which also uses apache2.










share|improve this question















I am trying to deploy my Laravel app in apache2 locally, however when trying to browse to http://myapp.localhost.com/ I am getting the following error:



Forbidden

You don't have permission to access / on this server.

Apache/2.4.7 (Ubuntu) Server at myapp.localhost.com Port 80


I created myapp.conf in /etc/apache2/sites-available to set up the virtual host:



<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/user/projects/myapp/public"
<Directory "/home/user/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>


And created a symlink in /etc/apache2/sites-enabled (sudo ln -s ../sites-available/myapp.conf)



Also edited the /etc/hosts file and added:



127.0.0.1   myapp.localhost.com


Any clue why I am getting this error? I am also having the same problem when trying to deploy the application to heroku, which also uses apache2.







server permissions apache2 php laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 8 '17 at 12:50









karel

56.2k11124142




56.2k11124142










asked Jan 16 '15 at 16:30









dabadaba

3152518




3152518












  • If needed PM me. I'll have a look to any questions you have. But your virtual host seems to be missing some options ;)
    – Rinzwind
    Jan 16 '15 at 19:09










  • sure, I'd like you to ask you soome questions
    – dabadaba
    Jan 16 '15 at 19:27


















  • If needed PM me. I'll have a look to any questions you have. But your virtual host seems to be missing some options ;)
    – Rinzwind
    Jan 16 '15 at 19:09










  • sure, I'd like you to ask you soome questions
    – dabadaba
    Jan 16 '15 at 19:27
















If needed PM me. I'll have a look to any questions you have. But your virtual host seems to be missing some options ;)
– Rinzwind
Jan 16 '15 at 19:09




If needed PM me. I'll have a look to any questions you have. But your virtual host seems to be missing some options ;)
– Rinzwind
Jan 16 '15 at 19:09












sure, I'd like you to ask you soome questions
– dabadaba
Jan 16 '15 at 19:27




sure, I'd like you to ask you soome questions
– dabadaba
Jan 16 '15 at 19:27










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










I am missing the



Options Indexes FollowSymLinks Includes ExecCGI


in your myapp.conf. As of Apache-2.4 mod_authz_host is used and Require (example Require all granted) should be used.



By the way... this:




You don't have permission to access / on this server.




I remember from the apache as the default when using httpd.conf. Are you sure the sites-*/* are being used?






share|improve this answer























  • I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
    – dabadaba
    Jan 16 '15 at 19:15










  • I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
    – Rinzwind
    Jan 16 '15 at 19:30










  • I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
    – dabadaba
    Jan 16 '15 at 19:49










  • Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
    – Rinzwind
    Jan 16 '15 at 19:59










  • how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
    – dabadaba
    Jan 16 '15 at 20:09


















up vote
0
down vote













In your VirtualHost write the DocumentRoot to point to your Laravel Application in your home directories. In addition you must add the Directory shown below, with your own path.



<Directory /home/john/Laravel_Projects/links/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>


The second step, you must go to your Laravel Project and run the following command.



sudo chmod -R 777 storage bootstrap/cache


At the end restart your apache2:



sudo service apache2 restart





share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f574473%2flaravel-and-apache2-403-forbidden%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    I am missing the



    Options Indexes FollowSymLinks Includes ExecCGI


    in your myapp.conf. As of Apache-2.4 mod_authz_host is used and Require (example Require all granted) should be used.



    By the way... this:




    You don't have permission to access / on this server.




    I remember from the apache as the default when using httpd.conf. Are you sure the sites-*/* are being used?






    share|improve this answer























    • I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
      – dabadaba
      Jan 16 '15 at 19:15










    • I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
      – Rinzwind
      Jan 16 '15 at 19:30










    • I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
      – dabadaba
      Jan 16 '15 at 19:49










    • Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
      – Rinzwind
      Jan 16 '15 at 19:59










    • how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
      – dabadaba
      Jan 16 '15 at 20:09















    up vote
    1
    down vote



    accepted










    I am missing the



    Options Indexes FollowSymLinks Includes ExecCGI


    in your myapp.conf. As of Apache-2.4 mod_authz_host is used and Require (example Require all granted) should be used.



    By the way... this:




    You don't have permission to access / on this server.




    I remember from the apache as the default when using httpd.conf. Are you sure the sites-*/* are being used?






    share|improve this answer























    • I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
      – dabadaba
      Jan 16 '15 at 19:15










    • I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
      – Rinzwind
      Jan 16 '15 at 19:30










    • I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
      – dabadaba
      Jan 16 '15 at 19:49










    • Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
      – Rinzwind
      Jan 16 '15 at 19:59










    • how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
      – dabadaba
      Jan 16 '15 at 20:09













    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    I am missing the



    Options Indexes FollowSymLinks Includes ExecCGI


    in your myapp.conf. As of Apache-2.4 mod_authz_host is used and Require (example Require all granted) should be used.



    By the way... this:




    You don't have permission to access / on this server.




    I remember from the apache as the default when using httpd.conf. Are you sure the sites-*/* are being used?






    share|improve this answer














    I am missing the



    Options Indexes FollowSymLinks Includes ExecCGI


    in your myapp.conf. As of Apache-2.4 mod_authz_host is used and Require (example Require all granted) should be used.



    By the way... this:




    You don't have permission to access / on this server.




    I remember from the apache as the default when using httpd.conf. Are you sure the sites-*/* are being used?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jan 16 '15 at 19:06

























    answered Jan 16 '15 at 19:01









    Rinzwind

    203k27388522




    203k27388522












    • I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
      – dabadaba
      Jan 16 '15 at 19:15










    • I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
      – Rinzwind
      Jan 16 '15 at 19:30










    • I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
      – dabadaba
      Jan 16 '15 at 19:49










    • Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
      – Rinzwind
      Jan 16 '15 at 19:59










    • how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
      – dabadaba
      Jan 16 '15 at 20:09


















    • I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
      – dabadaba
      Jan 16 '15 at 19:15










    • I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
      – Rinzwind
      Jan 16 '15 at 19:30










    • I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
      – dabadaba
      Jan 16 '15 at 19:49










    • Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
      – Rinzwind
      Jan 16 '15 at 19:59










    • how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
      – dabadaba
      Jan 16 '15 at 20:09
















    I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
    – dabadaba
    Jan 16 '15 at 19:15




    I added Options Indexes FollowSymLinks Includes ExecCGI and Require all granted and now it works. I am trying to access my application through my mobile phone (which is in the same network), however when browsing myapp.localhost.com I am not getting the page. How can I do this?
    – dabadaba
    Jan 16 '15 at 19:15












    I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
    – Rinzwind
    Jan 16 '15 at 19:30




    I would start by checking apache log and see if your mobile reaches your site. If it does not: router. If it does it will have a error notice.
    – Rinzwind
    Jan 16 '15 at 19:30












    I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
    – dabadaba
    Jan 16 '15 at 19:49




    I am not sure what I should be looking at in the log to see what you're saying. I can see a line in the access.log that some lines go like this 192.168.1.135 - - [16/Jan/2015:20:14:54 +0100] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.93 Mobile Safari/537.36" it says Android so it has tobe the phone
    – dabadaba
    Jan 16 '15 at 19:49












    Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
    – Rinzwind
    Jan 16 '15 at 19:59




    Yes it will be the phone. Means the problem is in the site itself probably and not in the network.
    – Rinzwind
    Jan 16 '15 at 19:59












    how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
    – dabadaba
    Jan 16 '15 at 20:09




    how is the problem in the site? it works in my machine, why wouldn't it work in the phone?
    – dabadaba
    Jan 16 '15 at 20:09












    up vote
    0
    down vote













    In your VirtualHost write the DocumentRoot to point to your Laravel Application in your home directories. In addition you must add the Directory shown below, with your own path.



    <Directory /home/john/Laravel_Projects/links/public/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    Require all granted
    </Directory>


    The second step, you must go to your Laravel Project and run the following command.



    sudo chmod -R 777 storage bootstrap/cache


    At the end restart your apache2:



    sudo service apache2 restart





    share|improve this answer

























      up vote
      0
      down vote













      In your VirtualHost write the DocumentRoot to point to your Laravel Application in your home directories. In addition you must add the Directory shown below, with your own path.



      <Directory /home/john/Laravel_Projects/links/public/>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all
      Require all granted
      </Directory>


      The second step, you must go to your Laravel Project and run the following command.



      sudo chmod -R 777 storage bootstrap/cache


      At the end restart your apache2:



      sudo service apache2 restart





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        In your VirtualHost write the DocumentRoot to point to your Laravel Application in your home directories. In addition you must add the Directory shown below, with your own path.



        <Directory /home/john/Laravel_Projects/links/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        Require all granted
        </Directory>


        The second step, you must go to your Laravel Project and run the following command.



        sudo chmod -R 777 storage bootstrap/cache


        At the end restart your apache2:



        sudo service apache2 restart





        share|improve this answer












        In your VirtualHost write the DocumentRoot to point to your Laravel Application in your home directories. In addition you must add the Directory shown below, with your own path.



        <Directory /home/john/Laravel_Projects/links/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        Require all granted
        </Directory>


        The second step, you must go to your Laravel Project and run the following command.



        sudo chmod -R 777 storage bootstrap/cache


        At the end restart your apache2:



        sudo service apache2 restart






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 5 at 4:27









        Ioannis Chrysochos

        1




        1






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f574473%2flaravel-and-apache2-403-forbidden%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido