如何使用Nginx在嵌套路由中部署reactjs应用程序?

时间:2019-06-18 07:19:43

标签: nginx react-router

我有一个网站登录页面,用户可以从/的域中访问该页面。它是静态页面,没有问题。 我有一个reactjs应用程序,应该可以从/ help之类的子路由访问它。 我使用nginx config来做到这一点,并且一切正常,但是当我转到诸如/ help / foo之类的reactjs应用程序的子路由并刷新页面时,出现404错误。 我的nginx配置是:

        LinearLayout frameLayout = new LinearLayout(SubmitBills.this);
        frameLayout.setOrientation(LinearLayout.HORIZONTAL);
        frameLayout.setPadding(0, 20, 0, 20);

        ImageView icon = new ImageView(SubmitBills.this);
        icon.setImageResource(R.drawable.img);

        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100);
        icon.setLayoutParams(params);

        LinearLayout dataLayout = new LinearLayout(SubmitBills.this);
        dataLayout.setOrientation(LinearLayout.VERTICAL);

        LinearLayout one = new LinearLayout(SubmitBills.this);
        one.setOrientation(LinearLayout.HORIZONTAL);

        ITextView billerLabel = new ITextView(SubmitBills.this);
        ITextView biller = new ITextView(SubmitBills.this);
        ITextView dueAmtLabel = new ITextView(SubmitBills.this);
        ITextView dueAmt = new ITextView(SubmitBills.this);

        billerLabel.setText(R.string.biller_label);
        biller.setText(billsDtList.get(i).getBillerDesc());
        dueAmtLabel.setText(R.string.dueAmount);
        dueAmt.setText(billsDtList.get(i).getDueAmount());

        billerLabel.setPadding(0, 0, 30, 0);
        biller.setPadding(0, 0, 30, 0);
        dueAmtLabel.setPadding(0, 0, 30, 0);
        dueAmt.setPadding(0, 0, 30, 0);

        TextViewCompat.setTextAppearance(billerLabel, R.style.darkTextStyleRegular);
        TextViewCompat.setTextAppearance(biller, R.style.darkTextStyleRegular);
        TextViewCompat.setTextAppearance(dueAmtLabel, R.style.darkTextStyleBold);
        TextViewCompat.setTextAppearance(dueAmt, R.style.darkTextStyleRegular);

        one.addView(billerLabel);
        one.addView(biller);
        one.addView(dueAmtLabel);
        one.addView(dueAmt);

        dataLayout.addView(one);

        frameLayout.addView(icon);
        frameLayout.addView(dataLayout);

        bills.addView(frameLayout);

0 个答案:

没有答案