1

Currently, I have the following IP address with this port:

http://292.168.14.23/
http://292.168.14.23:80/

The above addresses behave identically and have been used for serving the local UCSC Genome Browser.

What I want to do now is to set a new IP address, say http://292.168.14.23:8080/ -- namely using 8080 as a port instead of the default 80 -- that I can use to serve basic files in Apache. So when I do this:

http://292.168.14.23:8080/my_spec_dir/myfile.txt

I can navigate and download the files from the browser. How can I do that?

Following this instruction, I tried changing this file /etc/httpd/conf/httpd.conf with these lines:

Listen 8080
ServerName 292.168.14.23:8080

Although this address work: http://292.168.14.23:8080, I still cannot get access to the file: http://292.168.14.23:8080/my_spec_dir/myfile.txt

Note that my_spec_dir is stored under /web/html, and it is configured in httpd.conf this way:

#
# Relax access to content within /var/www.
#
<Directory "/web/html">
    AllowOverride All
    # Allow open access:
    Require all granted
    Header set Access-Control-Allow-Origin "*"
</Directory>
scamander
  • 3,218
  • 3
  • 21
  • 49
  • This could be useful, please have a look:https://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port – Deepanshu Nov 02 '18 at 08:52
  • @Deepanshu I don't have GUI, all using command line. – scamander Nov 02 '18 at 08:53
  • 1
    Along with modifications in **httpd.conf**, make one more entry in **http-ssl.conf** `Listen 8082(any free port) ServerName localhost:8082`....save and restart apache....and check if it works. – Deepanshu Nov 02 '18 at 09:06
  • Please, allow us to Google that for you: [apache add ip and change port](https://www.google.com/search?q=apache+add+ip+and+change+port). – jww Nov 02 '18 at 11:03
  • Your action should be enough. What error do you see when trying to access http://292.168.14.23:8080/my_spec_dir/myfile.txt ? Is it possible that Selinux block it.(you can verify it by setting Selinux to permissive mode: # setenforce 0) – Elvis Plesky Nov 06 '18 at 05:18

2 Answers2

2

Are you sure you have added configuration override through htaccess files?

<Directory /path/to/public/website/>
   AllowOverride All <--
   ...
</Directory>

How to Set AllowOverride all

Htaccess manual: https://httpd.apache.org/docs/current/howto/htaccess.html

1

If you want to change global document root

Listen 8080
ServerName 292.168.14.23
DocumentRoot "/web/html/my_spec_dir"

Or if you want a virtualhost.

Listen 8080
<VirtualHost 292.168.14.23:8080 >
    DocumentRoot "/web/html/my_spec_dir"
    ServerName 292.168.14.23

    # Other directives here
</VirtualHost>