V
V
vladislav9972020-08-19 15:11:40
Apache HTTP Server
vladislav997, 2020-08-19 15:11:40

VPS. How to configure Apache correctly so that it opens not localhost, but a specific url?

Tell me, there is a VPS. How to configure Apache correctly so that it opens not localhost, but a specific url?

config:

<VirtualHost *:80>
    ServerName *IP*
    ServerAlias www.*IP*
    DocumentRoot /var/www/project
    <Directory /var/www/project>
        AllowOverride All
        Order Allow,Deny
        Allow from All
    </Directory>
...

then it turns out now if you go to the ip of this vps, does it open localhost? right? and how to make it open for example project.loc url when you go to its ip?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-08-19
@shambler81

1. remove this machine to work with pure linux you don't have enough experience.
2. install bitrix VM
or vestacp
or braynicp
or God forbid ispmanager
(all of them are installed in 1 click)
, in fact, they will deal with all this crap for you, and you will not lose anything in performance.
And the point here is not Apache, but the fact that there are dozens of demons on the web server and they need to be configured
starting from bind ending with letsencrypt where it’s easier to take an already working system.
If you are interested in understanding then ispconfig3 (not to be confused with ispmanager)
Your question is:
everything is not a localhost you have a default config that performs /dev/null functions only for a web site that says "any domain".
for your site, you need to specify the domain explicitly.
that is, you create a separate config with separate settings and apply it.
After that, unparsed requests go to the default config, and what you need is through an explicitly designated domain.
Actually everything.
By going to any domain that will lead to this server, both technical and ordinary, and ip in addition. you will be taken to the local dev zero. that is, in the default config.
But if you specify a special case, then you will get to a specific config and it will give you a different path.

ServerName naydikvartiru.ru
        DocumentRoot /var/www/naydikvartiru/data/www/naydikvartiru.ru

However, the configs may differ depending on how your web server is built, whether there are nginx views of the php representation, the number of their versions, and so on and so forth.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question