Skip to main content

Moving a Site from Windows Hosting to Linux

Migration · 29.09.2026

How Windows hosting differs from Linux

Windows hosting usually runs on IIS with ASP.NET and an MSSQL database, or MySQL through ODBC. Linux hosting uses Nginx or Apache, PHP or Node.js, and MySQL/PostgreSQL. The key difference for a move is that the Windows file system is not case-sensitive for file names, while Linux is.

Before migrating, identify the site's stack: a classic ASP.NET Framework site has no direct Linux equivalent and needs porting to .NET Core or a full rewrite. A PHP site running under IIS usually moves to Linux without any code changes.

What to rewrite in the site's code

Check file paths: Windows-style paths (C:\inetpub\wwwroot\images) do not work on Linux, which needs forward slashes. Find absolute paths in the code and replace them with relative paths or environment constants.

File name case matters on Linux: if the code references Image.JPG but the file is named image.jpg, the site returns a 404 error. Check all references with a project-wide search:

grep -rn "\.jpg\|\.png\|\.php" /var/www/site --include=*.php -i

Migrating the database: MSSQL to MySQL or PostgreSQL

You cannot load an MSSQL dump directly into MySQL — the formats are incompatible. Use a tool like mssql2mysql, or export the data to CSV and load it with LOAD DATA INFILE.

bcp "SELECT * FROM dbo.orders" queryout orders.csv -c -t, -S oldserver -U sa -P password
mysql -u dbuser -p newdb -e "LOAD DATA LOCAL INFILE 'orders.csv' INTO TABLE orders FIELDS TERMINATED BY ','"

Check the data types: MSSQL's NVARCHAR maps to MySQL's VARCHAR with utf8mb4 encoding, and DATETIME2 maps to a regular DATETIME. The full process of moving the database itself is covered in the MySQL database migration guide.

Migrating files and handling name case

Copy files over SFTP or rsync, preserving permissions. On Linux, the site's files are usually owned by a dedicated user, not root:

rsync -avz --chmod=D755,F644 /export/site/ user@newserver:/var/www/site/
chown -R sitename:sitename /var/www/site

After copying, search for files with uppercase letters in their extension — a common cause of broken image links after a move from Windows.

Configuring a web server instead of IIS

IIS rules from web.config must be translated into an Nginx or Apache configuration by hand — there is no automatic converter. Check the rewrite rules, custom error page handling, and caching headers. The differences between the web servers and how to port the rules are covered in the article on migrating from Apache to Nginx.

Common mistakes after the move

  • 404 errors on images and scripts caused by mismatched file name case.
  • Broken Cyrillic-text encoding in the database — MSSQL often stores text in NVARCHAR with a different code page.
  • Hardcoded paths like C:\ left in the application's configuration files.
  • Different line endings: \r\n in Windows text files breaks some parsers on Linux.

Summary: Windows-to-Linux migration checklist

Before switching DNS, test the site on the new server by its direct IP address, compare the record counts in the database, and open a few pages with images. The full list of checks is in the post-migration checklist.

  1. Identify the stack: a PHP site moves directly, an ASP.NET Framework site needs porting.
  2. Convert the MSSQL dump to MySQL or PostgreSQL, checking data types.
  3. Copy files while preserving name case and permissions.
  4. Translate the IIS configuration into Nginx or Apache.
  5. Check the encoding and switch DNS only after a full verification.
← Back to Knowledge Base Ask Support