Hello, I have a LEMP droplet on which I want to host few sites. For now I have two applications: PhpMyAdmin and a Wordpress site. But my Wordpress site is stored in “/srv/www/mysite/mysite/src” and I want to access to this site via the URL “x.x.x.x/mysite” (x.x.x.x is my droplet IP of course) because I can’t use a domain name for the moment. So I tried a lot of things (with locations, aliases, root…) but none has worked. My last config file (works for PhpMyAdmin but not for “mysite”):
server {
listen 80;
listen [::]:80;
root /srv/www;
index index.php index.html;
# Hosts
server_name localhost x.x.x.x;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /mysite/ {
alias /srv/www/mysite/mysite/src;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
As I said I’ve made a lot of tests and none of them has worked (there are always errors 404 and 500)… So thanks in advance for your help! :-)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
@qmarlats Just change the root and the server name.
If you want I would give you my email address and configure your Droplet.
@qmarlats I know what you are doing wrong. You need to do this :
Now you can access example.com/mysite
This comment has been deleted
@qmarlats look how I have done it, you just need to change the source and destination, you need link it from the root of your Server /
http://imgur.com/1O6VnTO,4CVZ69J
It can’t work if you rename the folder to mysite-s you need to copy and paste the code above
Here again
Here is my configuration :
You can do this over a symbol link
If it works, reply