访问由Virtual Box中的netbeans创建的localhost

时间:2016-09-26 12:58:45

标签: internet-explorer localhost virtualbox

是否有可能访问我在Virtual Box中的netbeans上运行的应用程序当前。

我的详细情况是这样的:

  1. 托管Ubuntu- Netbeans打开localhost:8080
  2. 还有依赖项应用程序也运行在localhost-数据库,solr ...
  3. 虚拟框窗口虚拟机(处理IE)
  4. 有没有办法访问:localhost:8080来自VB并且能够像在主机操作系统中一样测试应用程序(连接数据库,solr ...)

1 个答案:

答案 0 :(得分:0)

https://netbeans.org/kb/docs/php/project-setup.html#runConfiguration

指定新项目的默认运行配置

运行配置是用于运行PHP项目的存储设置。您可以为一个项目定义多个配置,并在它们之间来回切换。例如,如果应用程序已在本地开发并需要上载到远程生产服务器,则只需选择其他运行配置。运行配置适用于运行和调试。运行配置适用于以下常见用例:

Developing PHP web pages on a local machine with a local web server.
Executing PHP scripts using a local PHP engine. This approach is applied to PHP files that are not intended for outputting HTML. Therefore such scripts can be run without a browser.
Remote Development. The PHP source code and other application files are uploaded to a remote web server via FTP. This use case is common when the development is shared across multiple people.
A combination of the above use cases: an application is developed locally and deployed on a remote production server upon completion. During development, PHP scripts are executed if necessary.

创建新的PHP项目时,可以创建项目的默认运行配置。要为项目设置默认运行配置,请从“运行配置”面板的“运行方式”下拉列表中选择相关选项。可以使用以下选项:

Local Web Site. To use this run configuration, you need the Apache http server installed and running.
Remote Web Site (FTP/SFTP) (Separate tutorial). To use this configuration, you need a hosting account on a remote server and an FTP account on this server.
Script. This run configuration does not require that a web server be installed and running. You only need a PHP engine.

“自定义项目设置:运行配置”中介绍了创建其他运行配置或编辑默认运行配置的过程。它几乎与创建默认运行配置的过程相同,只是您使用现有项目的“属性”对话框而不是新项目向导。 本地网站

本地网站配置涉及计算机上安装的Apache Web服务器的Web文件夹中的PHP源文件夹的副本。项目通常具有本地和远程网站配置。请注意,设置本地网站运行配置的过程略有不同,具体取决于您是从现有源创建项目还是没有现有源。

设置本地网站配置:

From the Run As dropdown list, choose Local Web Site.
In the Project URL field, check the automatically generated URL address. Make sure that the Apache HTTP server listens to the default port 80. If not, specify the port number explicitly, in the format localhost:<port number>.
Project Run Configuration: Local Web Server
If you are creating the project from existing sources, you can choose which source file to use as the index file.
To store the project's source files in a different directory than the NetBeans IDE project, select "Copy files from Sources Folder to another location". If you are creating a project from existing sources, this is a required step, unless the existing sources were already in the web folder of your Apache server.
The field by default specifies the following path: <Document Root>\<New PHP Project>. Use the Browse button to specify a different path, if necessary.
The document root is the folder where the web server looks for files to open in the browser. The document root is specified in the web server configuration file.
The wizard detects the Apache installation type, either a component or within a package, and provides the path to the default location of the htdocs folder for the current installation type. Therefore, if you accepted the default settings during the installation of the Apache server or the AMP package, choose the path from the dropdown list.
Click Finish. The IDE creates your PHP project.

远程网站

请参阅教程将PHP应用程序部署到远程Web服务器。 脚本

From the Run As dropdown list, choose Script.
Project Properties dialog showing Run Configuration properties, with Run As...Script selected
To specify the location of the PHP engine, click the Configure button next to the Use Default PHP Interpreter box. The PHP Options dialog opens on the General tab.
Project Run Configuration: Script. Specifying the path to the PHP engine and the output location
In the PHP 5 Interpreter field, specify the path to the php.exe file. Use the Browse or Search... button, if necessary.
To specify how the script execution results will be shown, select the relevant checkbox in the Open Result In area. The following options are available:

    Output Window. The results of executing a script will appear in the output window in the bottom of the NetBeans IDE window.
    Web Browser. The default browser window will open with the results of executing a script in the form of an HTML file.
    Editor. The results of executing a script will open as an HTML file in the IDE editor window.
Click OK. The Options dialog box closes and the system returns to the Run Configuration panel.
Add any arguments, such as debug=true, and any PHP command-line options.

自定义项目设置

在项目创建期间,定义了基本项目设置:项目类型,项目源文件的位置以及默认运行配置。要使用新设置扩展项目设置,请自定义项目。将光标定位在项目节点上,然后从弹出菜单中选择“属性”。将打开“项目属性”面板,其中包含设置类别列表。 来源

在“来源”面板上:

The Web Root field shows the root folder of your application site. By default, the field shows the Sources folder. To change the web root, click Browse and select another folder.
Select the Copy files from Sources Folder to another location, if necessary, and specify the path to the storage folder.
Change the encoding, if necessary
Managing project setup: Project Properties dialog box
To complete the project customization, click OK.

运行配置

在“运行配置”面板上,根据需要修改默认运行配置和/或定义新运行配置。

To modify the default settings, update the fields as during the project creation.
To define a new run configuration, click New next to the Configuration dropdown list. The Create New Configuration dialog box opens.
In the Configuration Name field, enter the name of the new run configuration and click OK. You return to the Run Configuration panel.
Define the run configuration settings in the same way as you defined the default run configuration during the project creation and click OK. The new configuration is added to the Configuration dropdown list.
To remove a configuration, select it from the Configuration dropdown list and click Delete.
Managing project setup: Run configuration   
To complete the project customization, click OK.