我正在一个 react-js 项目中工作,我有一个安装了 apache 服务器的云服务器。我的问题是我可以在 apache 服务器上设置我的react项目吗?
Apache 服务器上的 React、js
IT技术
apache
reactjs
react-router
2021-05-23 04:00:51
3个回答
正如 Davin Tyron 所说,react是一种浏览器技术,除了客户端的浏览器从您的服务器下载应用程序之外,一切都发生在客户端的计算机上。
只需确保您的 apache(或任何其他服务器)为您的 React 应用程序提供正确的 html 和 js 文件即可运行!
您必须使用代码更改 apache 配置文件
<VirtualHost *:80> DocumentRoot/Users/Your User Name/Sites/ <Directory"/Users/Your User Name/Sites/"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost>
不,您不能在 apache 服务器上设置您的项目。我认为您必须将 Docker 用于此类事情。
那有意义吗?React 只是一个前端库,用于制作可重用的 UI 组件。