Current Page: NeXtMidas User's Guide Third-Party Compatibility Apache
| ### Apache To use NeXtMidas with an Apache web server, follow these steps to configure Apache and setup a web-server link. #### Configuration for Java Web Start The web server (httpd) has to return a special MIME type for JNLP files: '`application/x-java-jnlp-file`' in order for web browsers to understand how to handle them. To do this for all files ending with `.jnlp` under Apache, add the following line to the `httpd.conf` configuration file:
    AddType application/x-java-jnlp-file    .jnlp
    AddType application/x-java-archive      .jar
    AddType application/x-java-archive-diff .jardiff
1. Apache will then send the correct MIME type to the browser and therefore Java will be started when the JNLP file is clicked on. Reminder: Restart your web server for the new configuration to take place. #### Configuration for CGI and allowing directory (index) browsing ##### Method 1 Create a NeXtMidas configuration file named `nextmidas_httpd.conf` that contains the following Apache configuration directives (substitute the appropriate path to `$NMROOT` for `"/home/midas/nextmidas"`):
       Alias /nmroot/ "/home/midas/nextmidas/"
       <Directory "/home/midas/nextmidas/">
         Options Indexes +FollowSymLinks
       </Directory>
       ScriptAlias /nmcgi/ "/home/midas/nextmidas/nxm/sys/test/"
3. The `ScriptAlias` defined in the above example (`"nmcgi"`) allows you to run the test macros (located in `nxm.sys.test`). However, you may change it to point to the location of any script. Now, add the following line to Apache's `http.conf` file which is usually located in `/etc/http/conf/` in RedHat Linux (substitute the appropriate path to the file created in Step 1 for `"/etc/http/conf"`):
       include /etc/http/conf/nextmidas_httpd.conf
4. Restart Apache. On RedHat Linux, this is accomplished with the following command:
       $ /sbin/service httpd restart
   -OR-
       $ /etc/init.d/httpd restart
   -OR-
       $ /usr/sbin/apachectl restart
1. ##### Method 2 You can setup a web-server to access NeXtMidas in a way that does not involve modification to the Apache configuration file. To do this, define links in the "DocumentRoot" directory (defined in the httpd.conf file). In the default installation of RedHat Linux, DocumentRoot is defined as /var/www/html.
       ln -s $NMROOT nmroot
2. Then we must enable Apache to follow links
       <Directory /home/midas/nextmidas/>
             Options Indexes +FollowSymLinks
       </Directory>
3. #### Testing Apache settings Test the configuration by opening a web browser and going to `http://<myserver>/nmroot/` (include the trailing slash). Your browser should display the index.html in your NMROOT directory (or a listing of files in NMROOT). Optionally, Try running the TEST_HTTPD and TEST_CGI macros that will test server. In NeXtMidas run the following:
       nM> home test
       nM> %test_httpd
       nM> %test_cgi
3. #### FAQs Q: When I access the NMROOT URL in my browser, why am I getting the error "You don't have permission to access /nmroot/ on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request." A: You probably have a permissions problem in one or more of the directories to NMROOT. Try setting each of them to be readable and executable by user/group/other. Q: Why am I getting the error "The requested URL /nmroot was not found on this server." A: Check to see if you put the slash(/) at the end of the URL, i.e. http://<myserver>/nmroot/ Q: When I try to run the TEST_CGI macro in nxm.sys.test I get an error stating "...Server returned HTTP response code: 500...". I know the "ScriptAlias" directive is set to correctly point to nxm.sys.test in my configuration file but I still get the error. What am I doing wrong? A:The most likely cause of this problem is that Apache is unable to execute the CGI scripts used by the TEST_CGI macro. In order for Apache to be able to execute any CGI scripts they must be executable. The easiest way to set the scripts used by TEST_CGI to be executable is to do the following in a unix shell:
       $ cd $NMROOT/nxm/sys/test
       $ chmod a+x *.sh