redirecting domain to subfolder with .htaccess

I’m new to using and changing the workings of a server and all that. So far I’ve only had one server with one domain for myself, but now a business is getting some traction and I want to use a different domain for it while keeping it on my server.

The situation is like this:

I have the main domain and root directory like maindomain.com. I also just bought projectdomain.com.

The files for projectdomain.com are within maindomain.com/project/.

I have established a forward from projectdomain.com to maindomain.com/project/ already, but I can’t access sites via the url.

For example:

I wan’t to type projectdomain.com/somecontent/ and access maindomain.com/project/somecontent while maintaining the projectdomain.com link in the adress bar.

When I try it now I always end up in maindomain.com/project/ and never in the file I specified in the url.

I’ve tried working around it with the .htaccess file, but don’t really know much about it. What I have now is

RewriteEngine On RewriteCond %{HTTP_HOST} (www\.)?projectdomain.com RewriteRule (.*) http://maindomain.com/project/$  1 [R=301,L] 

Sorry for the noob question, I really don’t know much about the topic and I’m not sure what to google to get what I want.

how to setup ssh tunnel to named virtual host

I’m currently setting up server inside our lab at Uni that will be used for multiple purposes including a bibliography database and a CI Server (Jenkins). In order to maintain clean separation of concerns, I have a jailed virtual host for each function along with an assigned internal domain name. Inside the lab, the arrangement works fine.

However, in order to connect to our lab from home, we need to first VPN into the Uni and then SSH into our lab’s gateway machine. From the gateway we can access any internal machines we need to reach, and use SSH Tunnels as needed.

I’m wondering if it is possible to access virtual hosts through a single SSH tunnel? Like Server Name Indication (SNI)? Or would I need to setup a proxy server like Squid? I gather that both DNS as well as HTTP traffic would need to be routed correctly. Can this be done using just hosts file settings?

Any advice would be much appreciated. Thanks!

How to split a file with round robin

I am reading the split –help but I am unsure how to execute this command with the round robin feature, can someone please give me an example

Usage: split [OPTION]... [FILE [PREFIX]]  -n, --number=CHUNKS     generate CHUNKS output files; see explanation below  The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).  CHUNKS may be:     N       split into N files based on size of input     K/N     output Kth of N to stdout     l/N     split into N files without splitting lines/records     l/K/N   output Kth of N to stdout without splitting lines/records           --> r/N     like 'l' but use round robin distribution     r/K/N   likewise but only output Kth of N to stdout 

Unable to start logstash service due to ruby dependency

I am running Logstash on Raspberry Pi jessie and it is stuck in a restart loop. Syslog reports the following:

Apr 20 17:00:11 raspberrypi logstash[12578]: org/jruby/RubyKernel.java:984: warning: It seems your ruby installation is missing psych (for YAML output). Apr 20 17:00:11 raspberrypi logstash[12578]: To eliminate this warning, please install libyaml and reinstall your ruby. Apr 20 17:00:11 raspberrypi logstash[12578]: [ERROR] 2019-04-20 17:00:11.776 [main] Logstash - java.lang.IllegalStateException: Logstash stopped processing because of an error: (GemspecError) Apr 20 17:00:11 raspberrypi logstash[12578]: [!] There was an error while loading `logstash-core-plugin-api.gemspec`: load error: psych -- java.lang.RuntimeException: BUG: we can not copy embedded jar to temp directory Apr 20 17:00:11 raspberrypi logstash[12578]: Does it try to require a relative path? That's been removed in Ruby 1.9. Bundler cannot continue. Apr 20 17:00:11 raspberrypi systemd[1]: logstash.service: main process exited, code=exited, status=1/FAILURE Apr 20 17:00:11 raspberrypi systemd[1]: Unit logstash.service entered failed state. Apr 20 17:00:12 raspberrypi systemd[1]: logstash.service holdoff time over, scheduling restart. Apr 20 17:00:12 raspberrypi systemd[1]: Stopping logstash... Apr 20 17:00:12 raspberrypi systemd[1]: Starting logstash... Apr 20 17:00:12 raspberrypi systemd[1]: Started logstash. 

As suggested in the error itself I have tried re-installing libyaml and ruby 1.9.3 using rvm but to no avail. Any thoughts?

How to apply Kubernetes cluster to an existing azure virtual mechines

I have an existing azure virtual machines that deployed 30 docker containers. So I have decided to use Kubernetes service/cluster to manage deploy dockers container on that existing azure virtual machines. I have also deploy azure registry to store docker images.

Is it possible way? Please help to give me your opinion?

nginx will not use apache2 as a proxy

Error Log:

2019/04/20 14:42:12 [error] 13387#13387: *107 connect() failed (111: Connection refused) while connecting to upstream, client: 94.174.93.252, server: dev.exoscape.co.uk, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "dev.exoscape.co.uk", referrer:  "https://dev.exoscape.co.uk/" 

Server Configuration:

server {    server_name dev.exoscape.co.uk;    location / {       proxy_pass http://localhost:8080/;   }      listen 443 ssl; # managed by Certbot     ssl_certificate /etc/letsencrypt/live/dev.exoscape.co.uk/fullchain.pem; # m$       ssl_certificate_key /etc/letsencrypt/live/dev.exoscape.co.uk/privkey.pem; #$       include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot     ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot  }   server {      if ($  host = dev.exoscape.co.uk) {         return 301 https://$  host$  request_uri;     } # managed by Certbot    server_name dev.exoscape.co.uk;     listen 80;     return 404; # managed by Certbot  } 

I have Apache2 running on port 8080 with my website running. When I visit the page I get 502 Bad Gateway. How can I access my files in /var/www/html through Apache2?

Get the best Cheap Dedicated Server hosting from the leading server providers

With the help of numerous online portals out there in the market, you can easily acquire the Cheap Dedicated Server Hosting solution in a hassle-free manner. Starting from a decent amount, the dedicated servers are made available to you so that your business can grow and reach the highest level of success. No matter how small or big an organization is, the need for getting efficient servers is inevitable as it helps in enhancing the productivity of your company.

If you are planning to get the Cheap Dedicated Servers online, it is suggested to ensure the fact that the chosen website is a completely reliable one so as to avoid any major problem in the long run. There are a number of online stores which have a professional team of experts who are responsible for handling each and every aspect of your server. They are at your service round the clock and you can always contact the customer service department in case of any confusion or query as well. Moreover, you should also check out the pages like About Us, Terms and Conditions, Privacy, and Refund Policy of the chosen virtual store so that you know exactly what you are getting yourself into.

Yes, choosing the platform of Dedicated Server Hosting means that you might have to spend a lot of bucks from your pocket but the end results are definitely worth every penny of yours. Before taking the final decision, consider your budget, needs, and requirements in mind.

Wireguard sends packets with source port 1 when using second routing table

I have a small home server in my basement that’s connected to a router and my home network. As my cable ISP only offers public IPv6 addresses and IPv4 is behind a carrier grade NAT I bought myself a public IPv4 address using a OpenVPN connection to a third party. As the contract with the latter provider includes some traffic limitations I only want to route the “public” server traffic over the VPN connection. All in all, it looks like this:

-------------------------- | WG Host                | |------------------------| | eth0:  192.168.1.30    | <- dhcp, home network, default gateway | tun0:  214.144.203.5   | <- vpn with public ipv4 address, gw for public services | vmnet: 192.168.5.1     | <- virtual machines, server daemons | wg0:   192.168.10.1    | <- wireguard -------------------------- 

Most services I have are on the vmnet subnet, ssh (on port 110) and wireguard (on port 123) are supposed to run on the host. I have set up a second routing table and route all traffic with source ports like 80 or 443 over the VPN connection unless an internal client connects to the services, because I do not want to route all that traffic over the internet when in fact the server is right inside my home network. To be able to do this, I’ve come up with some rather complex iptables-rules:

iptables -A POSTROUTING -t nat -o tun0 -j MASQUERADE  # Always set source IP to VPN ip, so home network clients do not get confused iptables -A POSTROUTING -t nat -p tcp --sport 80 -j SNAT --to 214.144.203.5 iptables -A POSTROUTING -t nat -p tcp --sport 443 -j SNAT --to 214.144.203.5  # public services, default gateway via vpn iptables -A PREROUTING -t mangle -p tcp --sport 80 -j MARK --set-mark 2 iptables -A PREROUTING -t mangle -p tcp --sport 443 -j MARK --set-mark 2  # Do the same for ssh & wireguard (123/udp) iptables -A OUTPUT -t mangle -p tcp --sport 22 ! -d 192.168.1.0 -j MARK --set-mark 2 iptables -A OUTPUT -t mangle -p udp --sport 123 ! -d 192.168.1.0 -j MARK --set-mark 2  ip rule add fwmark 2 table 2 ip route add default via 214.144.203.4 dev tun0 table 2 ip route add 192.168.5.0/24 dev vmnet table 2 ip route add 192.168.1.0/24 dev eth0 table 2 

This works pretty well for the vmnet services and ssh, but wireguard’s behavior seems to be a little bit strange: It works inside my home network, but when I try to reach it from the outside, it won’t work. When doing a tcpdump on tun0 I can observe that the client’s packets reach wireguard just fine. The answering packets are obviously sent on tun0, too (so routing seems to work). The strange thing is that Wireguard sets the source port of these packets to ‘1’. Unfortunately, they never reach the client. I suppose that is because the NATs in between don’t manage to match the (srcport,dstport) combination anymore.