.htaccess file cant be read on 9999 but working on 8080 - apache

I am trying to do something in .htaccess file but before doing it i am facing some problem and i have no clue about it
first of all my UAT server's html pages can be accessed through
http://xx.xx.xx.xx:9999/cms
and in 9999 it is hosted in apache-tomcat
and htaccess file code :
RewriteEngine on
dadada
but its not throwing 500 internal server error it means it cant read .htaccess file
BUT
but in 8080 is only in apache2.2
http://xx.xx.xx.xx:8080/cms/
in port 8080 it is mapped to /var/www/html/ so i place my html file here with .htaccess file and wooohhhaa it was working on 8080 with 500 server error but it when i deleted .htaccess file and just browse ny index page it says
"Forbidden
You don't have permission to access /cms/ on this server."
now i have two questions.
Why htaccess is not running on port 9999 but on 8080?
and whats wrong with the permissions on 8080?

Related

Domain Name cannot be changed in Apache on CentOS 7

I have set up a server with a wiki and Wordpress and Nextcloud on a new Domain, let's say it's testing.com. When I was finished, I wanted to change the Domain from testing.com to realdomain.com.
The server is running CentOS 7 with httpd (apache), so I changed the ServerName in /etc/httpd/conf/ to "realdomain.com". Then I changed the VirtualHosts in all the files in /etc/httpd/conf.d.
I added the new Domain to the trusted Domains of the Wordpress, Nextcloud and wiki. I restarted the httpd service and the server itself.
Yet, when I open realdomain.com in browser, it shows me my websites, but it puts testing.com in the address field.
I tried using mod_rewrite to change the URL, but then my webbrowser tells me that the site doesnt redirect correctly and that the redirects never stop.
I tried those rewrite rules in the .conf files and in the .htaccess (not simultaneously)- no success.
I removed all my files in conf.d and created a new DocumentRoot with a simple helloWorld.html - The Url still gets rewritten to testing.com.
Are there any other locations that could have rewrite rules? Did I miss anything?
Thank you so much in advance, this is killing me!

http://localhost is getting forwarded

I am using Xampp and in my htdocs directoy I have a folder called 'task4u'. If I go to http://localhost, I'll get forwarded to the page of 'task4u' (which is a Symfony 4 application).
In htdocs I have now created a new folder for a new website but I still get forwarded to the directory 'task4u'.
I have checked the windows file 'hosts' but there is nothing related to this issue.
Where could that forwarding be set? Is that because of Symfony itself maybe?
Windows host file contains only a redirect to 127.0.0.1 (loopback address) for "localhost" (or you can configure more redirects to 127.0.0.1).
You have to give a look to httpd.conf Apache file; it should be under this path for a XAMPP installation: C:\XAMPP\apache\conf\httpd.conf. Open httpd.conf with a text editor and change it with your new directory path under DocumentRoot C:/your/path and < Directory C:/your/path/>
Remember to restart Apache server by XAMPP interface.

Redirect url to specific port not working in htaccess

I am working on 2 servers and .htaccess file working on 1 server but not working on second server.
.htaccess file
RewriteEngine On
RewriteRule ^socket.io/(.*)$ ws://example.com:3000/socket.io/?$1 [P,QSA,L]
I am working on socket, so i dont want to show :port in url, so i just redirect url to port within htaccess
Url examples server 1,
ws://example.com/socket.io/etc Redirect ON ws://example.com:3000/socket.io/etc (working)
http://example.com/socket.io/etc Redirect ON ws://example.com:3000/socket.io/etc (working)
But on server 2, same code on different domain return "Internal Server Error"
I dont want to change my code, because it is my backup server, so i
want to run same code, but what i am missing? Is there any apache extension
required or what i am missing?

DigitalOcean hosting with GoDaddy domain denying access to root directory

I own a domain on GoDaddy and am attempting to point it to my DigitalOcean-hosted website. Here are the steps I have taken so far:
I cloned the git repo containing all of my website files from local to my DigitalOcean server.
I added an # record on godaddy for my domain and pointed it to my DigitalOcean IP address.
IMPORTANT!! I modified /etc/apache2/sites-enabled/000-default.conf with my new VirtualHost pointing mydomain.com to index.html, NOT THE ROOT DIRECTORY.
I then proceeded to do 'service apache2 restart' while sshed to DigitalOcean on terminal.
I assumed this would work and then tested it out and went to mydomain.com. Not so much. This is the error I got:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80
This was obviously pretty surprising given that it was not redirecting to index.html, so I manually appended /index.html to mydomain.com only to find that it gave me an identical error only I could not access /index.html instead of /.
I have done this kind of things many times before, however I used subdomain records for godaddy on an existing domain instead of using a brand new domain with no subdomains. Where did I go wrong?
Thanks!
Brandon
UPDATE: I tried on a test subdomain with test.mydomain.com and got this new error:
Not Found
The requested URL / was not found on this server.
Apache/2.4.7 (Ubuntu) Server at test.mydomain.com Port 80
You noted you modified the virtual host to point to index.html but not the root directory. Apache would still use the root directory (DocumentRoot) to locate the index.html file. If it is looking in the wrong location it could explain the 403 error (looking in a place that the web server user [www-data] cannot read as an example).
Beyond that, a 403 like that could be permission related. You would want to ensure the DocumentRoot and index.html file have the ownership of www-data:www-data and they are all readable by the web server itself (755 for folders and 644 for files is the norm).

How do I find out where my root URL is being served from in Apache?

I've recently got a VPS server and it came installed with CentOS, WHM and cPanel. I'm trying to find where the physical folder location the root URL of the server IP is being served. When I go to the root IP in a browser, I get a redirect to "/cgi-sys/defaultwebpage.cgi" with "SORRY!" and some error resolve details.
The server has a web-site running under "/cPanel" and also WHM runs on ":2083".
I'm trying take control of the content served directly at the /, and replace that defaultwebpage.cgi with an index.html.
I've tried httpd -V to check where the httpd.conf, is and then spotted a <VirtualHost *> in that config file, which points to a DocumentRoot of /use/local/apache/htdocs . But if I place index.html in this folder and try to hit it via /index.html, I still get routed to that defaultwebpage.cgi. Can anyone help me understand why its rerouting and not picking up that index.html?
Thanks.
You may want to try /var/www/html, at least that's in Ubuntu
If it's not it, then try going to /etc/apache2/apache2.conf and find the DocumentRoot option.
Hope this helps!