I have this server running LEMP hosted on Digital Ocean. I use it for 2 reasons:
I would like to migrate to Vapor. But I have questions as to how it works.
Old and running PHP version
A user is usually accessing: example.com/news_service.php
New Vapor version
I would like to create a similar "get" address: example.com/news/service
Questions:
Does anyone know if by installing Swift and Vapor, I could mess up my old system? Would I have to get another droplet to build this new system? Is it possible to re-direct all requests to a certain folder, and ONLY that folder will run the Vapor app (get the requests) while everything else is running on LEMP?
Thanks to I --marc I for pointing out "Server Blocks", I can just go to
$ cd /etc/nginx/sites-available
And add the address you want to use - In my case /iOSService/
Any request going to that path will be dealt with Vapor Server, running on port 8080
location /iOSService/ {
proxy_ignore_client_abort on;
proxy_pass http://localhost:8080/;
proxy_redirect off;
}
Also, if you want phpmyadmin to keep working, make sure you keep these lines there:
# Phpmyadmin Configurations
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
# PHPmyadmin configurations ends
And finally, to keep serving your files don't forget:
location / {
try_files $uri $uri/ =404;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.