Pasword protect a particular URL with apache server on Ubuntu - configuration

I would like to password protect a subdomain like meet.example.com but not other URLs on that subdomain (e.g., meet.example.com/page_name, this should be accessible)
I tried a few answers already but none worked for me. I tried this and this and some others (using htpasswd and .htaccess and etc.).
Server version: Apache/2.4.52 (Ubuntu)

Related

Finding MySQL localhost URL and/or accessing phpmyadmin

Going around in circles. Please help, I enter http://localhost into safari on my mac and receive: It works!
However, I cannot figure out how using MySQL workbench I can find the URL. I am looking to code JSON in xCode to retrieve data from my local MySQL database, however, I do not even know the URL to access it.
My port is on 3306. I have tried http://127.0.0.1:3306 - and get a failed to open.
Do I need myphpadmin or can I go direct to MySQL?
I have tried saving a copy of MyPhPAdmin under Users>MyUserName> but this did not work when I ran: http://localhost/myphpadmin
Should the file be saved elsewhere? When I worked on Python weeks ago I run it under a different location then was recommended (Under the Python X.X cache folder) whereas online people simply ran it from their Users>MyUserName> folder. I am on the latest Catalina OS X.
Tried http://localhost/usr/local/mysql-8.0.20-macos10.15-x86_64/phpmyadmin/ - 404 not found
With MySQL, you can connect via localhost "socket" or networking "TCP/IP" connections. The user accounts in MySQL exist separately from each other, so if your user account exists with host value 'localhost' the TCP/IP connection probably won't work for you. Also note that, depending on how you installed MySQL and how it's configured, it might not even listen for network connections. Normally, localhost is preferred if you are on the same machine.
In MySQL Workbench, you need to give the hostname or IP address when selecting "Standard (TCP/IP)" from the "Connection Method" dropdown. This is simply the hostname or IP address, not a complete URL or web site. So you'd set the hostname to "127.0.0.1" or "192.168.9.34" or whatever. Again, Local Socket/Pipe is usually a better choice in most cases.
MySQL uses its own networking port (3306) and communication protocol, so using http://127.0.0.1 is incorrect as it isn't using the http protocol. Likewise, if you would need to change the port for some reason, specify that in the port field rather than as a part of the hostname.
As for phpMyAdmin, you would install that to a folder that is handled by your web server, then access it through the URL/path exposed by the web server — by default, your user home directory is not shared to the web (and rightly so, I don't want all of my documents and files shared with the world!). Put the phpMyAdmin folder in your web root and you'll have better success. Which folder that is probably depends a lot on which webserver you are running, how it is installed, and how you configured it.
I won't comment on the Python scripts you've run in the past, as my experience with serving Python to the web requires adjusting some settings in my nginx configuration and I won't want to confuse you compared to the tutorials you're following.

Connecting to a remote apache server

I need to connect to the server "http://ec2-52-57-235-167.eu-central-1.compute.amazonaws.com/" . I have the server's username and password access. I tried accessing from Filezilla but it says the "Invalid protocols specified."
What is the recommended way to access this server remotely from the internet so that I can access its files and edit its contents.
The server is hosted online now I want to access it from my local machine.
P.S. I also tried to find out the I.P address of this url but can't seem to figure out by the command "Tracert" in the command line.
Thanks.
Install putty and access the server with SSH connection. Filezilla won't work due to precedence of protocols.

Apache2 Linux GoDaddy

Hi I'm new to website development and I am trying to configure a number of websites from my home based server using Apache2 and Linux Mint.
I have setup three new websites in addition to the 000-default page.I have created the Virtual Host config files in sites-available and have added the sites to Host.conf. Internally(on the server in a browser) they are all working fine - I can access all four sites using localhost or the URLs I've configured them with -tested with and without the www. prefix and all seems fine. The four sites are just basic HTML scripts with different headers and different one line body.
I've added Listen 8090 to Listen 80 on my ports.conf file and have opened port 80 and 8090 on my firewall and have updated Port Forwarding on my router and tested they are open using PortCheckTool. The two ports are open and every other port is locked out so that seems good too.
I've tried to configure a GoDaddy domain name to direct activity to one of these sites. The domain name that works internally (on the server in a browser) is the same as my GoDaddy domain name I've bought. I've been into my GoDaddy account and pointed this domain at my external IP address (tried also adding port to forwarding 8090 as well as leaving port number as default). However when I access this domain from my mobile phone using 3G with WIFI turned off I just get sent to the 000-default homepage.Same using default Port 80 and with Port Forwarding to 8090. I have script for both 80 and 8090 in my site config files in sites-available directory.
So the connection is getting to the server, ports are OK, it's just that apache2 doesn't redirect the GoDaddy traffic but redirects fine locally on the server for the same site!?
Any ideas what I am missing?
Any help would be much appreciated.
Thanks.

How to set up www directory to public? WAMP

I cant seem to find any good solution for my issue so I hope this question will be answered once and for all.
First, I understand that by hosting my html files online directly from my PC means to loosen up my PC security and that can be dangerous. But I am fine with this as this is just my testing laptop. Nothing important or whatsoever in here.
So lets start with the main issue. I have port forwarded the port 3306, 80, 8080, and 2727(which I plan to switch the apache port to this)
Tested port online and result is open.
In my apache httpd.conf file, here is what I have setup..
Listen 0.0.0.0:2727
ServerName xxx.xxx.x.xx:2727 (which is my private ip)
<Directory "c:/wamp/www/">
Options FollowSymLinks Indexes
Allow from all
Order Allow,Deny
AllowOverride All
Require all granted
</Directory>
I am now able to access my index.html in the wamp www directory by typing 127.0.0.1:2727 in the url (same goes to /phpmyadmin)
What should I do next to make sure my public ip can access the index.html?
Example, when I enter my public ip like this 175.162.154.18:2727, it just shows connection timed out.
Extra info if this helps :
My WAMP is orange.
I have the MYSQL Community Edition in my PC.
My WAMP version is 2.5
Apache version is 2.4.9
MySQL version is 5.6.17
Apache service test port 80 is not used.
I apologize in advance if my question seems difficult to understand but I will try my best to provide as much information as per request.
Modify apache httpd.conf file
Listen 2727
Basically WAMP and MySQL Community Edition does not work quite well together.
What I did was uninstall every program and files related to MySQL and WAMP. Restarted my PC and continue to delete existing folder related to both MySQL and WAMP.
Then, I installed a fresh WAMP again and it is finally green in color! Hooray!
So I head over to the httpd.conf file and edited Listen 80 since it is the default and my ISP is not blocking port 80 and ServerName 192.168.0.x:80 which is my Private IP address. I did not modify any other than this in the file and when I type my public ip by using my mobile data network, it connected successfully to my local website!
Conclusion to set-up your own website ONLINE on your PC (with WAMP) :
Obtain your private ip address (can be obtained from cmd by typing ipconfig)
Login to your router and port forward the port 80 (or another if your ISP is blocking port 80) under your PRIVATE ip address. Note : I port forwarded both TCP & UDP.
In Apache httpd.conf file, edit the Listen to your port number that you have port forwarded. (Eg. Listen 80)
Edit the ServerName below to ServerName xxx.xxx.xx.xx:80 where the ip is your private ip address. If you use a different port, change the 80 to your own port.
And basically that is it! Type your public ip in your browser url and done! Note: If you use another port you will need to type in your port number as well eg. 177.122.140.13:8080 (If port 8080 is what you chose)
Result :

Using UNC path as paths location in Mercurial IIS6 Server2003

I'm running the latest Mercurial and Python 2.6; IIS6 is using the wildcard ISAPI method to attach the site to the Mercurial hgwebdir_wsgi
[paths]
\ = \\COMP3254\TestRepo\*
[web]
baseurl = /
allow_push = *
push_ssl = false
style = monoblue
The setup works perfectly if I reference the local drive E:\repo* but doesnt work if I specify the network as above; I've given the server (MERCDEV01$) full permissions on the shared folder on COMP3254, I can't think of any other reason it wouldn't work.
Could be a delegation problem. You can NTLM-authenticate to the webserver (and your credentials will be trusted on its local drives), but the webserver can't authenticate you to a remote location, because it does not know your password (i.e. it can't delegate your credentials).
Have you tried setting up the network location as a virtual directory on the server? You can then enter credentials IIS will cache and use for accesses to that location.
hgwebdir doesn't work for me either with UNC paths - It means you can't use it as a server without hosting the repos on the same machine as the web server.
Ok.. I solved it. The user running the web server (Apache in my case) defaulted to Local System, which does not have permission to access network resources. When I changed it to a user with domain access (and gave that user admin access to the local machine) everything worked fine.
Running a web server with that sort of privilege is of course risky - but in my case it is an internal server. Presumably you can cherry pick just the right permissions to do this in a more secure manner.