I will summarize the flow of uploading what was created in the local environment on the server and publishing it. I will summarize the clogged parts etc. in a memorandum.
1 Contract for Sakura VPS 2 Construction of Linux environment 3 Domain acquisition 4 Document route change 5 SSL
First of all, from the Sakura VPS contract. Click here to apply for Sakura VPS
There is a 14-day trial period, so if you can complete it during that period, you can study for free.
Registration is complete Log in to the control panel as shown below.
Information on the contracted VPS is described.
Purchase the Udemy course below to study Linux. [Can be done in 3 days] Introduction to Linux server construction for the first time (CentOS 7, PHP 7, Docker compatible)
I personally recommend it because I was able to study the flow from installing CentOS on VPS to building a LAMP environment in an easy-to-understand manner.
**-Set up a firewall and log in with SSH ** → Check the port where the firewall is set → Reload and reflect the updated content → Restart the daemon to reflect on the SSH server
** ・ What can be done by general users and privileged (root) users on the server **
General user
= Can read and write files under your own directory
Privileged (root) user
= User with administrator privileges
Give general users administrator privileges Since the instructions of the root user are absolute and there is a possibility that system files etc. may be deleted by mistake, it is basically preferable to give the general user administrator privileges to perform operations.
**-Change firewall settings so that the server can be accessed from the outside ** → Cannot access if this cannot be set
Once this is done and you connect to your VPS IP address, you'll be taken to the Apache standard page.
Because the default document root is / var / www / html
For example, if you put ʻindex.htmlunder this, the contents will be displayed. The URL looks like this
xx.xx.xx.xx/index.html`
You can display the IP address as it is, but you need to acquire a domain in order to recognize the service when publishing the web application.
Obtain a domain from Sakura Internet or Name.com.
See the link below for how to set up your domain [Domain setting] Use the domain acquired and managed by Sakura Internet
In short, link the IP address of the server with the acquired domain.
When the setting is completed, it is the same even if you rewrite the domain that acquired the IP address part (xx.xx.xx.xx
) that was displayed in the above xx.xx.xx.xx / index.html
. You will be able to access.
Lets encrypt this time to issue SSL certificate for free
** Stumble points ** I installed it and issued a certificate, but it is not SSL-enabled ** → Apache needs to be set after issuing the certificate ** In /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/letsencrypt/live/[Server domain]/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/[Server domain]/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/[Server domain]/chain.pem
Set each Reference article https://weblabo.oscasierra.net/letsencrypt-2/
Change the default document root so that the site is displayed when you access the acquired domain.
Without this change, for example, if you create a ʻexample directory under the default
/ var / www / html and put ʻindex.html
under that, the URL will bedomain /example/index.html. It becomes a little ugly with
.
Make the following settings so that the top page is displayed when only the domain is entered.
Located in <VirtualHost *: 80>
at the bottom of /etc/httpd/conf/httpd.conf
Change DocumentRoot to the directory you want to see.
In the above example, by changing the document root that is / var / www / html
to / var / www / html / example
, the contents of ʻindex.html` will be displayed when accessing the domain. To.
Recommended Posts