Your (1) and (2) would function the same most of the time. But if I try, I think I can imagine a context where they would mean slightly different things.
(1) I'm telling someone an anecdote, about something that happened to me. I'm far from home when I tell this story. Let's say the story starts out in a town not far from my own -- let's call it Jackson. At a certain point in my story, the listener needs to know that the town where I live isn't far from Jackson. Maybe there's going to be a dramatic car ride to go pick up some item that is urgently needed in time for a concert that's going to start shortly. Let's say the item was in a suitcase that the airlines have misplaced. To explain that my town isn't far from Jackson, I say, "I live in a nearby town. So I jumped in my car and drove home as fast as I could. I grabbed my copy of the score of Beethoven's Fifth and raced back to the concert hall in Jackson, arriving just as the orchestra was tuning."
(2) Note that this sentence wouldn't work in the story about the dramatic car ride.
Moving on. In (A), "nearby" is describing "restaurant;" since "restaurant" is a noun, "nearby" functions as an adjective in this sentence. In (B), "nearby" tells us where you live. Therefore it functions as an adverb in this sentence.
(C): adverb; (D): adjective; same analysis as for (A) and (B).
To get better at distinguishing between adjectives and adverbs, I recommend that you start by practicing with simple sentences. Use a different symbol to indicate each one -- for example, circle the adjectives, and underline the adverbs. You could even use different colors. BUT before you do that, you should get completely solid on identifying NOUNS and VERBS. When you can do that comfortably and easily, the adjectives and adverbs will jump off the page at you, for the most part.
Do you have a teacher who can check your exercises?
We can rephrase the sentence slightly, with emphasis:
The range of purposes that gongs are used for includes as a military signal, [as] a rhythmic accompaniment, and [as] a ritual instrument.
With this in mind, most of your questions become hard to parse, because include as isn't a coherent unit. I would just point out that you should not replace including with which include/s. This isn't because you can't do so, grammatically, but because it's not clear whether the verb should agree with (singular) range or (plural) purposes, and whichever you choose, nitpicking pedants will come out of the woodwork to correct you.
Best Answer
(The following analysis is adapted from Huddleston and Pullum, The Cambridge Grammar of the English Language, 2002, Ch. 7, 'Prepositions and Preposition Phrases').
Preposition phrases may in some contexts 'stack', just like adjectives and adverbs:
Prepositions may take other sorts of objects than noun phrases:
Prepositions may also take no object. It appears to be this use which you call an 'adverbial preposition'; CGEL calls it an intransitive preposition, analogous to an intransitive verb. (I will abbreviate this Pi.) Such a preposition may act syntactically as a complete preposition phrase (PP), just as a bare intransitive verb may act as a complete verb phrase (VP), a bare adjective as a complete adjective phrase (AdjP) or a bare noun or pronoun as a complete noun phrase (NP).
Many such Pi in fact started as actual PP—along and before, for instance, whose first elements are worn-down forms of on and by, respectively. Others, however, are quite ordinary transitive prepositions which have evolved intransitive uses. Consider
Traditional grammar treats on as an adverb modifying the verb put, but contemporary grammar understands it as a Pi acting as a PP which in turn acts as a locative complement to the verb, exactly like
Your sentence, then, may be understood as embedding two PP complementing came; the first PP is the bare Pi up, and the second PP is headed by from and takes a third PP, the Pi behind, as its object.