New Magento 2, nginx config error 403 forbiddenNginx Magento 2 403Magento Admin Nginx 404Icon are not displaying after setting up cdn for static view files for magento 2Migrated from Apache to Nginx Except Homepage , Every Other Page shows 404?500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issuesUnable to run Magento 2 Web Setup on nginxNginx Magento 2 403Apache Nginx Varnish listening port Magento 2

Why does matter stays collapsed following the supernova explosion?

Can you board the plane when your passport is valid less than 3 months?

What is the name of this plot that has rows with two connected dots?

Shift lens vs move body?

Using Update Cursor within Search Cursor with ArcGIS Pro?

Why is a statement like 1 + n *= 3 allowed in Ruby?

rationalizing sieges in a modern/near-future setting

Hangman game in Python - need feedback on the quality of code

Under what circumstances does intermodulation become an issue in a filter after LNA setup?

Number of academics in various EU countries

How many petaflops does it take to land on the moon? What does Artemis need with an Aitken?

Do you pay one or two mana to bounce a transformed Delver of Secrets with Repeal?

How do you capitalize agile costs with less mature teams?

How to sort a dictionary of lists and get the corresponding keys?

Can MuseScore be used programmatically?

Is this password scheme legit?

Set orthographic view using python?

How many birds in the bush?

Cooking Scrambled Eggs

Why is getting a PhD considered "financially irresponsible" by some people?

What does it take for witness testimony to be believed?

Why is the UK so keen to remove the "backstop" when their leadership seems to think that no border will be needed in Northern Ireland?

What is the meaning of “these lederhosen are riding up my Bundesliga”?

Weird corners with cline



New Magento 2, nginx config error 403 forbidden


Nginx Magento 2 403Magento Admin Nginx 404Icon are not displaying after setting up cdn for static view files for magento 2Migrated from Apache to Nginx Except Homepage , Every Other Page shows 404?500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issuesUnable to run Magento 2 Web Setup on nginxNginx Magento 2 403Apache Nginx Varnish listening port Magento 2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















After my installation of magento2 on Ubuntu, I get this error on localhost http://localhost/magento2/ - 403 forbidden



I have to change the port to any other like 8080 in file /etc/nginx/sites-available/magento, in order to be able to load the website like this http://localhost:8080/magento2/



I know that nginx is able to server various sites, and I was expecting to use this http://localhost:80/magento2/ but I get error 403 forbidden



In my understanding as far as you have a root directory for each virtual hosts, the web-server will pull the site files from those locations, so it should not matter if this is the same port, if you specific the folder with the content after server name, in my case: http://localhost:80/magento2/



Is there anyone able to advice how this supposed to be configured with nginx?,
thanks



My nginx config for magento is:




upstream fastcgi_backend
server unix:/run/php/php7.2-fpm.sock;


server

listen 80;
server_name localhost/magento2;
set $MAGE_ROOT /var/www/html/magento2;
include /var/www/html/magento2/nginx.conf.sample;



Default is just:


server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;

server_name _;

location /

try_files $uri $uri/ =404;










share|improve this question


























  • Check by commenting htaccess first.

    – Mitro
    Aug 14 at 13:37











  • Hi @Mitro Thanks for helping here, I can't follow what you wrote, What should I do with "htaccess first". In my root there is that file magento@bonecrusher:/var/www/html/magento2$ ls -la .htaccess -rwxrwxr-x 1 www-data www-data 12076 jun 25 16:12 .htaccess Not sure how to proceed with your advice, cheers

    – farp332
    Aug 14 at 13:51












  • rename .htaccess with any other name. Means it should not to be work and check after that

    – Mitro
    Aug 14 at 13:54












  • @Mitro I renamed the file .htaccess under root dir: /var/www/html/magento2, then edited file /etc/nginx/sites-available/magento to use port 80 (restarted nginx) and I got again 403 forbidden.... I renamed as well .htaccess under pub/ then under static/ just to understand whether this affects the site, and still same error. I have the site loading (with not styles, images, .. not ideas why this, will open another question) with port 8080, but every tutorial shows that you can have the nginx default page and a new site using same port 80.

    – farp332
    Aug 14 at 14:18












  • Did you read this magento.stackexchange.com/questions/239541/nginx-magento-2-403

    – Mitro
    Aug 14 at 14:20

















0















After my installation of magento2 on Ubuntu, I get this error on localhost http://localhost/magento2/ - 403 forbidden



I have to change the port to any other like 8080 in file /etc/nginx/sites-available/magento, in order to be able to load the website like this http://localhost:8080/magento2/



I know that nginx is able to server various sites, and I was expecting to use this http://localhost:80/magento2/ but I get error 403 forbidden



In my understanding as far as you have a root directory for each virtual hosts, the web-server will pull the site files from those locations, so it should not matter if this is the same port, if you specific the folder with the content after server name, in my case: http://localhost:80/magento2/



Is there anyone able to advice how this supposed to be configured with nginx?,
thanks



My nginx config for magento is:




upstream fastcgi_backend
server unix:/run/php/php7.2-fpm.sock;


server

listen 80;
server_name localhost/magento2;
set $MAGE_ROOT /var/www/html/magento2;
include /var/www/html/magento2/nginx.conf.sample;



Default is just:


server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;

server_name _;

location /

try_files $uri $uri/ =404;










share|improve this question


























  • Check by commenting htaccess first.

    – Mitro
    Aug 14 at 13:37











  • Hi @Mitro Thanks for helping here, I can't follow what you wrote, What should I do with "htaccess first". In my root there is that file magento@bonecrusher:/var/www/html/magento2$ ls -la .htaccess -rwxrwxr-x 1 www-data www-data 12076 jun 25 16:12 .htaccess Not sure how to proceed with your advice, cheers

    – farp332
    Aug 14 at 13:51












  • rename .htaccess with any other name. Means it should not to be work and check after that

    – Mitro
    Aug 14 at 13:54












  • @Mitro I renamed the file .htaccess under root dir: /var/www/html/magento2, then edited file /etc/nginx/sites-available/magento to use port 80 (restarted nginx) and I got again 403 forbidden.... I renamed as well .htaccess under pub/ then under static/ just to understand whether this affects the site, and still same error. I have the site loading (with not styles, images, .. not ideas why this, will open another question) with port 8080, but every tutorial shows that you can have the nginx default page and a new site using same port 80.

    – farp332
    Aug 14 at 14:18












  • Did you read this magento.stackexchange.com/questions/239541/nginx-magento-2-403

    – Mitro
    Aug 14 at 14:20













0












0








0








After my installation of magento2 on Ubuntu, I get this error on localhost http://localhost/magento2/ - 403 forbidden



I have to change the port to any other like 8080 in file /etc/nginx/sites-available/magento, in order to be able to load the website like this http://localhost:8080/magento2/



I know that nginx is able to server various sites, and I was expecting to use this http://localhost:80/magento2/ but I get error 403 forbidden



In my understanding as far as you have a root directory for each virtual hosts, the web-server will pull the site files from those locations, so it should not matter if this is the same port, if you specific the folder with the content after server name, in my case: http://localhost:80/magento2/



Is there anyone able to advice how this supposed to be configured with nginx?,
thanks



My nginx config for magento is:




upstream fastcgi_backend
server unix:/run/php/php7.2-fpm.sock;


server

listen 80;
server_name localhost/magento2;
set $MAGE_ROOT /var/www/html/magento2;
include /var/www/html/magento2/nginx.conf.sample;



Default is just:


server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;

server_name _;

location /

try_files $uri $uri/ =404;










share|improve this question
















After my installation of magento2 on Ubuntu, I get this error on localhost http://localhost/magento2/ - 403 forbidden



I have to change the port to any other like 8080 in file /etc/nginx/sites-available/magento, in order to be able to load the website like this http://localhost:8080/magento2/



I know that nginx is able to server various sites, and I was expecting to use this http://localhost:80/magento2/ but I get error 403 forbidden



In my understanding as far as you have a root directory for each virtual hosts, the web-server will pull the site files from those locations, so it should not matter if this is the same port, if you specific the folder with the content after server name, in my case: http://localhost:80/magento2/



Is there anyone able to advice how this supposed to be configured with nginx?,
thanks



My nginx config for magento is:




upstream fastcgi_backend
server unix:/run/php/php7.2-fpm.sock;


server

listen 80;
server_name localhost/magento2;
set $MAGE_ROOT /var/www/html/magento2;
include /var/www/html/magento2/nginx.conf.sample;



Default is just:


server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;

server_name _;

location /

try_files $uri $uri/ =404;







magento2 nginx ubuntu linux webserver






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 14 at 14:18









Anas Mansuri

1,4602 silver badges16 bronze badges




1,4602 silver badges16 bronze badges










asked Aug 14 at 13:33









farp332farp332

1




1















  • Check by commenting htaccess first.

    – Mitro
    Aug 14 at 13:37











  • Hi @Mitro Thanks for helping here, I can't follow what you wrote, What should I do with "htaccess first". In my root there is that file magento@bonecrusher:/var/www/html/magento2$ ls -la .htaccess -rwxrwxr-x 1 www-data www-data 12076 jun 25 16:12 .htaccess Not sure how to proceed with your advice, cheers

    – farp332
    Aug 14 at 13:51












  • rename .htaccess with any other name. Means it should not to be work and check after that

    – Mitro
    Aug 14 at 13:54












  • @Mitro I renamed the file .htaccess under root dir: /var/www/html/magento2, then edited file /etc/nginx/sites-available/magento to use port 80 (restarted nginx) and I got again 403 forbidden.... I renamed as well .htaccess under pub/ then under static/ just to understand whether this affects the site, and still same error. I have the site loading (with not styles, images, .. not ideas why this, will open another question) with port 8080, but every tutorial shows that you can have the nginx default page and a new site using same port 80.

    – farp332
    Aug 14 at 14:18












  • Did you read this magento.stackexchange.com/questions/239541/nginx-magento-2-403

    – Mitro
    Aug 14 at 14:20

















  • Check by commenting htaccess first.

    – Mitro
    Aug 14 at 13:37











  • Hi @Mitro Thanks for helping here, I can't follow what you wrote, What should I do with "htaccess first". In my root there is that file magento@bonecrusher:/var/www/html/magento2$ ls -la .htaccess -rwxrwxr-x 1 www-data www-data 12076 jun 25 16:12 .htaccess Not sure how to proceed with your advice, cheers

    – farp332
    Aug 14 at 13:51












  • rename .htaccess with any other name. Means it should not to be work and check after that

    – Mitro
    Aug 14 at 13:54












  • @Mitro I renamed the file .htaccess under root dir: /var/www/html/magento2, then edited file /etc/nginx/sites-available/magento to use port 80 (restarted nginx) and I got again 403 forbidden.... I renamed as well .htaccess under pub/ then under static/ just to understand whether this affects the site, and still same error. I have the site loading (with not styles, images, .. not ideas why this, will open another question) with port 8080, but every tutorial shows that you can have the nginx default page and a new site using same port 80.

    – farp332
    Aug 14 at 14:18












  • Did you read this magento.stackexchange.com/questions/239541/nginx-magento-2-403

    – Mitro
    Aug 14 at 14:20
















Check by commenting htaccess first.

– Mitro
Aug 14 at 13:37





Check by commenting htaccess first.

– Mitro
Aug 14 at 13:37













Hi @Mitro Thanks for helping here, I can't follow what you wrote, What should I do with "htaccess first". In my root there is that file magento@bonecrusher:/var/www/html/magento2$ ls -la .htaccess -rwxrwxr-x 1 www-data www-data 12076 jun 25 16:12 .htaccess Not sure how to proceed with your advice, cheers

– farp332
Aug 14 at 13:51






Hi @Mitro Thanks for helping here, I can't follow what you wrote, What should I do with "htaccess first". In my root there is that file magento@bonecrusher:/var/www/html/magento2$ ls -la .htaccess -rwxrwxr-x 1 www-data www-data 12076 jun 25 16:12 .htaccess Not sure how to proceed with your advice, cheers

– farp332
Aug 14 at 13:51














rename .htaccess with any other name. Means it should not to be work and check after that

– Mitro
Aug 14 at 13:54






rename .htaccess with any other name. Means it should not to be work and check after that

– Mitro
Aug 14 at 13:54














@Mitro I renamed the file .htaccess under root dir: /var/www/html/magento2, then edited file /etc/nginx/sites-available/magento to use port 80 (restarted nginx) and I got again 403 forbidden.... I renamed as well .htaccess under pub/ then under static/ just to understand whether this affects the site, and still same error. I have the site loading (with not styles, images, .. not ideas why this, will open another question) with port 8080, but every tutorial shows that you can have the nginx default page and a new site using same port 80.

– farp332
Aug 14 at 14:18






@Mitro I renamed the file .htaccess under root dir: /var/www/html/magento2, then edited file /etc/nginx/sites-available/magento to use port 80 (restarted nginx) and I got again 403 forbidden.... I renamed as well .htaccess under pub/ then under static/ just to understand whether this affects the site, and still same error. I have the site loading (with not styles, images, .. not ideas why this, will open another question) with port 8080, but every tutorial shows that you can have the nginx default page and a new site using same port 80.

– farp332
Aug 14 at 14:18














Did you read this magento.stackexchange.com/questions/239541/nginx-magento-2-403

– Mitro
Aug 14 at 14:20





Did you read this magento.stackexchange.com/questions/239541/nginx-magento-2-403

– Mitro
Aug 14 at 14:20










1 Answer
1






active

oldest

votes


















0















drop all that and revert to default apache configuration.
then create virtual host with proper domain name.



for example www.mynewshop.com



<VirtualHost *:80>
ServerAdmin admin@mynewshop.com
ServerName www.mynewshop.com
ServerAlias www.mynewshop.com
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>


add this domain to your local hosts file: /etc/hosts



127.0.0.1 www.mynewshop.com


add your domain name to magento base url



php bin/magento setup:store-config:set --base-url="http://www.mynewshop.com/"
php bin/magento setup:store-config:set --base-url-secure="https://www.mynewshop.com/"
php bin/magento cache:flush


then just open it in your browser.






share|improve this answer



























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2fmagento.stackexchange.com%2fquestions%2f285500%2fnew-magento-2-nginx-config-error-403-forbidden%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    drop all that and revert to default apache configuration.
    then create virtual host with proper domain name.



    for example www.mynewshop.com



    <VirtualHost *:80>
    ServerAdmin admin@mynewshop.com
    ServerName www.mynewshop.com
    ServerAlias www.mynewshop.com
    DocumentRoot /var/www/html/
    <Directory /var/www/html/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    </Directory>
    </VirtualHost>


    add this domain to your local hosts file: /etc/hosts



    127.0.0.1 www.mynewshop.com


    add your domain name to magento base url



    php bin/magento setup:store-config:set --base-url="http://www.mynewshop.com/"
    php bin/magento setup:store-config:set --base-url-secure="https://www.mynewshop.com/"
    php bin/magento cache:flush


    then just open it in your browser.






    share|improve this answer





























      0















      drop all that and revert to default apache configuration.
      then create virtual host with proper domain name.



      for example www.mynewshop.com



      <VirtualHost *:80>
      ServerAdmin admin@mynewshop.com
      ServerName www.mynewshop.com
      ServerAlias www.mynewshop.com
      DocumentRoot /var/www/html/
      <Directory /var/www/html/>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      </Directory>
      </VirtualHost>


      add this domain to your local hosts file: /etc/hosts



      127.0.0.1 www.mynewshop.com


      add your domain name to magento base url



      php bin/magento setup:store-config:set --base-url="http://www.mynewshop.com/"
      php bin/magento setup:store-config:set --base-url-secure="https://www.mynewshop.com/"
      php bin/magento cache:flush


      then just open it in your browser.






      share|improve this answer



























        0














        0










        0









        drop all that and revert to default apache configuration.
        then create virtual host with proper domain name.



        for example www.mynewshop.com



        <VirtualHost *:80>
        ServerAdmin admin@mynewshop.com
        ServerName www.mynewshop.com
        ServerAlias www.mynewshop.com
        DocumentRoot /var/www/html/
        <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        </Directory>
        </VirtualHost>


        add this domain to your local hosts file: /etc/hosts



        127.0.0.1 www.mynewshop.com


        add your domain name to magento base url



        php bin/magento setup:store-config:set --base-url="http://www.mynewshop.com/"
        php bin/magento setup:store-config:set --base-url-secure="https://www.mynewshop.com/"
        php bin/magento cache:flush


        then just open it in your browser.






        share|improve this answer













        drop all that and revert to default apache configuration.
        then create virtual host with proper domain name.



        for example www.mynewshop.com



        <VirtualHost *:80>
        ServerAdmin admin@mynewshop.com
        ServerName www.mynewshop.com
        ServerAlias www.mynewshop.com
        DocumentRoot /var/www/html/
        <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        </Directory>
        </VirtualHost>


        add this domain to your local hosts file: /etc/hosts



        127.0.0.1 www.mynewshop.com


        add your domain name to magento base url



        php bin/magento setup:store-config:set --base-url="http://www.mynewshop.com/"
        php bin/magento setup:store-config:set --base-url-secure="https://www.mynewshop.com/"
        php bin/magento cache:flush


        then just open it in your browser.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 14 at 17:05









        MagenXMagenX

        2,67010 silver badges27 bronze badges




        2,67010 silver badges27 bronze badges






























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • 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%2fmagento.stackexchange.com%2fquestions%2f285500%2fnew-magento-2-nginx-config-error-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

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?