I am using PHP (5.3) to upload jpeg files, create folders for those files and store them. I have a development version and a live version both running on the same server (CentOS 7, Apache, Plesk 12).
On the live version, I am experiencing no problems, but on the dev version, the files are uploading successfully but I am getting nginx 404 errors when trying to access them through the browser.
If I try to access something which doesn't exist, I get a standard 404 error (not an nginx one).
When checking the access_log, I see a 200 code for the files.
Nothing in the error_log nor in the nginx error log.
No differences in PHP code, folder structure or configuration.
I recently changed servers and this is the first time I have attempted this upload on the dev system on this new server. Live version is used daily for this activity.
If I try to access older uploads on the dev server, they all work fine. It is only affecting new uploads.
Permissions and ownership are the same for both live and dev systems and old/new folders/files.
If I manually upload a jpeg to the folder, it also triggers an nginx 404 when accessed.
I have no experience with nginx so I am at a loss as to what I can try to resolve this issue.
It looks like you have upload and access files in one place but checking log in another place.
Are you sure you have no issues with domain name resolving?
Also it can be issue with virtual host - when you access file it overtaken by some other virtual host. It maybe default host for IP address.
I recommend you grep all system and vhost logs for file you have trying to access.
Related
I need to redirect HTTP to HTTPS, and www to non-www, with the Azure AppService version of Wordpress. This version uses the wordpress-alpine-php docker image, running nginx version 1.20.2.
I think I need to add a server block to nginx.conf, but I am not sure which version of this file it's using. I see the file in these locations.
/etc/nginx/nginx.conf
/home/site/wwwroot/nginx.conf
I've tried both of them, but neither seems to work. The one under etc doesn't seem to persist a container reload. I do know about copying the correct version and then reloading nginx with a startup command, as described in this Microsoft article.
Is nginx.conf the place to do this?
Which versions of the file is this using at runtime?
Is there a better way to do this with the azure app service?
I migrated my wordpress website into my local machine, but it's redirecting me to the original ,-server one-, website, immediately after I opennig the local one.
I try to describe what did I do as detailed as much I can:
First I got all wp files and copied-d it to my local XAMPP htdocs directory via SHH (FROM Linux Debian 10 - Apache 2 Webserver).
After that I exported the database (exported to sql file format).
I created the same database and user (with the same permissions as the server db user) in the local webserver
Everything went successfully, but after i want to open http://localhost/ I got redirected to my old site like https://originalsite.com
What did I tried to solve the problem:
I checked Apache, PHP and phpmyadmin version, but these are the same.
I reinstalled XAMPP but that also didn't solve the problem.
I checked wp-config.php but there aren't any options I've could been change, php.ini and my.ini both of them not gave me any alternative.
Thanks!
In the .sql file you imported, find "site_url" and change it to localhost URL. Or you can define it in wp-config.php file as "WP_SITEURL"
You will need to manually go in Database and Replace LIVE site URL with the Local URL.
Something like:
https://originalsite.com/
TO
http://localhost/originalsite
OK, so a little background on the environment configuration at present:
Using VS2017
IISExpress folder present in my documents folder with applicationhost.config file
When I run my web project in VS2017, it runs successfully through IISExpress. If I view the IISExpress config window then it shows me that my app is running successfully and that it's using the config from my source\repos folder and not the main IISExpress folder in my documents. If I look at the config file in the IISExpress folder there is no mention of the bindings for my currently running application (makes sense, as it apparently uses a different config file).
However, within my app I need to be able to use the Microsoft.Web.Administration toolset to try and identify the port bound to https for the current site to handle a redirect to a page that must be secure. In the production environment this is just handled by pushing to https:// because we know an SSL certificate will be present. But, when debugging locally I need to switch to SSL and take the port number otherwise my redirect is broken, for obvious reasons.
Using _Manager_ServerManager As New ServerManager
For Each _Loop_Binding As Binding In _Manager_ServerManager.Sites(System.Web.Hosting.HostingEnvironment.ApplicationHost.GetSiteName()).Bindings
If (_Loop_Binding.IsIPPortHostBinding) AndAlso (_Loop_Binding.Protocol.ToLower() = "https") Then Return _Loop_Binding.EndPoint.Port
Next
End Using
The code above causes an error when running, as the current site does not exist within _Manager_ServerManager.Sites. If I inspect this property then I can only see the applications that are configured in the configuration file taken from the IISExpress folder in my documents, not the current site!
I'm really scratching my head on this one, is there any way programmatically that I can get this information for the currently running website?!
EDIT
Based on some of the comments below, more clarity has been requested as to what I'm actually trying to achieve. The website typically operates on standard HTTP, however, when progressing to one particular page for security reasons we need to shift to HTTPS:
Response.Redirect("https://" & Request.Url.DnsSafeHost & "/my-page.aspx")
When debugging this website locally, using IISExpress, this results in you being redirected to https://localhost/my-page.aspx, which is incorrect because the site runs on a port of localhost (i.e. http://localhost:64905 and https://localhost:64906). This means that I cannot just append Request.Url.Port onto the end of DnsSafeHost, because it will not be the HTTPS port required. Thus, so that we can run this project locally on our dev machines we need to automatically switch the port to the HTTPS version so that we can continue seamlessly without any disruption and having to manually rebuild the URL each time we get redirected.
I migrated a SilverStripe website from one server to another. To do that I took the following steps:
Transferred a backup of the files from the old server and to the new server.
Dumped the old Database and imported it to the new server.
Updated _conn.php to connect to the new database.
Now when I hit the URL in a browser it is giving a 500 error. I didn't update the DNS for new server, instead I point to new server from my local system via hosts file. If I hit mywebsite.com/robots.txt, it is showing the robots.txt but not showing other pages.
500 error means server error which means something in apache(?), php or other logs. Ensure debug mode is on for SilverStripe to get the most information.
If all else fails start with checking your .htaccess is fine and redirecting and use with debug [die] statements progressively.
Ideally use the silverstripe-installer to debug any server issues and install a clean install, then you can copy the site over when you know it is working.
I got a 503 when trying to upload using the CollectionFS Filesystem adaptor (only on production, local works fine.)
the response headers show:
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Methods:PUT
Access-Control-Allow-Origin:http://meteor.local
I would like to know what this address is, but I could not find documentation about it.
Few thing that come to mind:
Your static files URL under the web server.
Do you set it to a virtual directory (location) on your web server?
If yes, check your nginx/apache virtual directory directives. Make sure there are correct
Do you handle it in your meteor application?
If you set it to your meteor application, did you set the route for it in your application correctly?
Permission issues between the user that run the web-server, the user that run the meteor application and the user that own the actual folder on the file system