react router browserHistory,nginx服务端应该怎么配置

2025-04-07 01:41:43
推荐回答(3个)
回答1:

请输入以下命令 cd /alidata/server/nginx/conf/rewrite 再输入:ll 看看是不是像下面截图的一样 对了。这些就是伪静态规则文件。我们打开phpwind.conf看看。 我们已经在rewrtie目录下配置了常见程序的伪静态规则。您可以直接调用。 如果没有就按照 程序名.conf的命名方式新建一个配置文件 配置文件搞清楚了,你可能会说好像网站伪静态还是啊。别着急,因为伪静态规则是需要被网站配置文件调用才行的。 输入以下命令 cd /alidata/server/nginx/conf/vhosts 进入到网站配置目录 修改好伪静态调用文件 下面测试下我们配置的文件是否正确吧 输入: /alidata/server/nginx/sbin/nginx -t 看到了么? nginx: the configuration file /alidata/server/nginx/conf/nginx.conf syntax is ok nginx: configuration file /alidata/server/nginx/conf/nginx.conf test is successful 如果出现以上两句话就说明配置成功了。下面重启下nginx /alidata/server/nginx/sbin/nginx -s reload 恭喜您,伪静态配置完成! 总结,其实与其它自行安装的服务器区别在于相关文件目录位置问题了

回答2:

请输入以下命令 cd /alidata/server/nginx/conf/rewrite 再输入:ll 看看是不是像下面截图的一样 对了。这些就是伪静态规则文件。我们打开phpwind.conf看看。 我们已经在rewrtie目录下配置了常见程序的伪静态规则。您可以直接调用。 如果没有就按照 程序名.conf的命名方式新建一个配置文件 配置文件搞清楚了,你可能会说好像网站伪静态还是啊。别着急,因为伪静态规则是需要被网站配置文件调用才行的。 输入以下命令 cd /alidata/server/nginx/conf/vhosts 进入到网站配置目录 修改好伪静态调用文件 下面测试下我们配置的文件是否正确吧 输入: /alidata/server/nginx/sbin/nginx -t 看到了么? nginx: the configuration file /alidata/server/nginx/conf/nginx.conf syntax is ok nginx: configuration file /alidata/server/nginx/conf/nginx.conf test is successful 如果出现以上两句话就说明配置成功了。下面重启下nginx /alidata/server/nginx/sbin/nginx -s reload 恭喜您,伪静态配置完成! 总结,其实与其它自行安装的服务器区别在于相关文件目录位置问题了

回答3:

在服务器端需要加上下面这句话,刷新后不显示页面的问题才能解决。
location / {
try_files $uri /index.html;
}