Yii::app()->getBaseUrl(true) return wrong URL - yii

I've used Yii::app()->getBaseUrl(true) in link to get root URL of server.
But It Return the URL like
http://applicationname/applicationname/login

If the application is not deployed on root of the server
Deployed on root of server
Yii::app()->getBaseUrl(true) return path is http://applicationname/login
OR
Deployed in any folder of server
Yii::app()->getBaseUrl(true) return path is http://applicationname/applicationname/login

Related

Domain name not pointing on root directory

I am using amazon linux ec2 instance i.e working fine with IP address.
My apache root directory is
/var/www/html
that is working fine when I am accessing my instance IP address.
Issue is when I am using my domain name. It's working only when I am adding "html" after domain name, like
domain/html
I implemented SSL certificate using let's encrypt library, may be that is reason of this issue
I tried to change my httpd.conf directory URL with www directory but that's not working.
Domain name continuously showing below error message but working when I am adding "html" at the end of domain name
Forbidden
You don't have permission to access this resource.
Looks like issue is with your vhost config, as you mentioned SSL certificates generated using Let's encrypt, check host file on below path and change document root directory with your original directory. Also check is there any other host file as well or not.
/etc/httpd/conf.d/vhost-le-ssl.conf

express.static() is not working on release

I am running Amazon EC2 #Ubuntu. I published my express application there and it is working good. Now I am trying to make access to static files through www.myurl.com/somefile so I can make SSL certificates public for nginx use.
I set up simple nginx as:
server {
listen 80;
sernver_name _;
location / {
proxy_pass: http://localhost:3000;
}
}
inside my express.js i put
app.use(express.static('wwwroot'))
When I start application locally, create folder wwwroot inside my project folder and add some file to it, i can access it through http://localhost:3000/file.txt but when I release project on my EC2, create folder, put file, it returns 404.
EDIT:
Just tried changing
app.use(express.static(path.join(__dirname, 'wwwroot'))
locally works, on EC2 ubuntu with nginx it doesn't

Express server issues for index.html, bundle.js, serving index.html for every router (b/c of react-router) and more

I have this:
let dir = __dirname + "/dist"
app.use(express.static(dir));
I log out dir and see that the URL is indeed the same location I've compiled (via webpack) my bundle.js. yet if (in Postman) I run a GET for localhost:8080/dist/bundle.js I get a Cannot GET /dist/bundle.js response.

apache setup multiple doc root

I have apache2 server with a private IP.
Also, I have multiple applications that need to run on the same server.
Is there any solution to setup different document root for each application
Like ..
http://xx.xx.xx.xx/application to doc root /var/ww/html
http://xx.xx.xx.xx/application1 to doc root /var/www/html/app1/public
http://xx.xx.xx.xx/application2 to doc root /var/ww/html/app2/public

myPage.com instead of mypage.com/WebContent

I have created my webpage in eclipse as Dynamic Web Project and uploaded the WebContent folder to the server (WebContent contains index.html js, imgs and css). When I call myPage.com, it works only with the url myPage.com/WebContent. Afterthat I have uploaded the content of the folder WebContent directory to the server root. Now when I call myPage.com, it display empty page. mypage.com/index.html display empty page too.
How to upload WebContent, sothat the index.html display woithout using WebContent in the url?
This can be achieved by:
Using URLRewrite. This thing changes URLs according to the patterns you configure. More to read: http://tomcat.apache.org/tomcat-8.0-doc/rewrite.html
Using redirects in the root folder - if someone requested the folder, it automatically sends you to another folder. This can be done by placing index.html in root folder containing: <meta http-equiv="refresh" content="0; url=http://mypage.com/WebContent" />;
Using Virtual Host - description for Tomcat 6.